Maritime-Robotics-Student-Society / sailing-robot

Southampton sailing robot
http://www.sotonsailrobot.org
Other
88 stars 46 forks source link

IMU pitch offset from boat pitch #188

Open takluyver opened 7 years ago

takluyver commented 7 years ago

The pitch we read from our IMU is about +10 degrees when we consider the boat to be level.

joshctaylor commented 7 years ago

This would depend if you reading euler angles or converting from a quaternion or cosine matrix.

Euler angles have a singularity known as gimbal lock which causes angles to approach infinity when pitch (or the middle angle) approaches 90 deg. You are unlikely to encounter gimbal lock if roll pitch and yaw are aligned with the boat axis unless you nose dive. If they are not you will start getting odd angles as the IMU algorithm will usually prevent the angle from displaying over 180 deg.

If you are using DCM or quats best practise is to 'subtract' (actually divide) the reference orientation (level facing north) before convert to euler angles in roll-pitch-yaw order to avoid gimble lock.

I hope this is useful.

Josh