Reply To: Simple Inclinometer with compass in python

Home Forums Forums Technical Support for BerryGPS and BerryGPS-IMU Simple Inclinometer with compass in python Reply To: Simple Inclinometer with compass in python

#6180
Mark Williams
Keymaster

it all depends on how you have the IMU orientated. And adjusting the code accordingly.
There are plenty of comments in the code... an example is below.

	####################################################################
	######################Correct rotation value########################
	####################################################################
	#Change the rotation value of the accelerometer to -/+ 180 and
    	#move the Y axis '0' point to up.
    	#
    	#Two different pieces of code are used depending on how your IMU is mounted.
	#If IMU is up the correct way, Skull logo is facing down, Use these lines
	AccXangle -= 180.0
	if AccYangle > 90:
		AccYangle -= 270.0
	else:
		AccYangle += 90.0
	#
	#
	#
	#
	#If IMU is upside down E.g Skull logo is facing up;
	#if AccXangle >180:
    	#        AccXangle -= 360.0
	#AccYangle-=90
	#if (AccYangle >180):
    	#        AccYangle -= 360.0
	############################ END ##################################

Mark --OzzMaker.com --

Blip, blop, bloop...