Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong coordinate system for SEN 14001? #43

Closed
subodh-malgonde opened this issue Jul 20, 2018 · 4 comments
Closed

Wrong coordinate system for SEN 14001? #43

subodh-malgonde opened this issue Jul 20, 2018 · 4 comments

Comments

@subodh-malgonde
Copy link

subodh-malgonde commented Jul 20, 2018

I am using Razor 9DOF IMU (hardware version SEN14001). The code in imu_node.py converts the readings from Razor AHRS firmware to ROS standards (REP 103). However when I test the orientations by measuring the acceleration due to gravity (9.8 m/s^2) on each axis by echoing messsages from the topic imu (I am running roslaunch razor_imu_9dof razor-pub.launch), I get very different orientations. See these Pictures:

This means the axis are oriented this way:

This is the left handed coordinate system, whereas ROS uses right handed coordinate system.

Am I missing something? I ask because according to PR #34 this repo supposed to work with SEN14001?

@subodh-malgonde
Copy link
Author

I observed values from the serial monitor, which shows data directly from Razor_AHRS, I get this coordinate system:

whatsapp image 2018-07-20 at 3 16 46 pm

So it looks like Razor_AHRS has the same coordinate system as REP-103, which is:

  1. X axis pointing forward (towards the short edge with the connector holes)
  2. Y axis pointing to the left
  3. Z axis pointing up

So imu_node.py does not need to modify anything. Am I right @lebarsfa?

subodh-malgonde pushed a commit to subodh-malgonde/razor_imu_9dof that referenced this issue Jul 20, 2018
@lebarsfa
Copy link
Member

This is a bit unexpected... The conventions should be the one described here : Razor-AHRS/razor-9dof-ahrs#57 (comment) ... See also https://github.com/Razor-AHRS/razor-9dof-ahrs/wiki/tutorial (around the middle of the page, the screenshot of Razor_AHRS_test.pde). With the serial monitor, do you get yaw=0 when towards the North, yaw=90 towards the East, yaw=-90 (or 270) towards the West? If it is not the case, that means that you probably use a different/modified firmware inside the Razor (also, do you use the default options?), or maybe your Razor is different...

For the accelerations, note this : https://github.com/KristofRobot/razor_imu_9dof/blob/fb23b76e4727cd294a84c453506ed6d5eeb7562e/nodes/imu_node.py#L240
This probably explains why the sign of the accelerations is the contrary.

@subodh-malgonde
Copy link
Author

subodh-malgonde commented Jul 23, 2018

Thank you so much for getting back!

With the serial monitor, do you get yaw=0 when towards the North, yaw=90 towards the East, yaw=-90 (or 270) towards the West?

I get yaw = 90 towards east. However when I orient it to north, it does not go to 0. Also for west it does not go to -90. I think my magnetometer is faulty. See this GIF, as I rotate the Razor around the Z axis, the visualitzation does not follow the actual movement.

ezgif-2-4e73ff3fae

I used Razor_AHRS_test.pde for the above sketch. For rotations around X & Y axes, it follows (this part is not in the GIF).

If it is not the case, that means that you probably use a different/modified firmware inside the Razor (also, do you use the default options?), or maybe your Razor is different...

I have not changed anything from Razor_AHRS.ino apart from HW__VERSION_CODE (14001). Is that what you mean by default options?

I think the firmware inside the Razor is different, maybe Sparkfun changed it.

subodh-malgonde referenced this issue in subodh-malgonde/razor_imu_9dof Jul 23, 2018
@subodh-malgonde
Copy link
Author

subodh-malgonde commented Jul 23, 2018

UPDATE: The incorrect yaw on the horizontal plane was due to non-calibrated sensors. This resulted in the IMU firmware applying incorrect drift correction for the gyroscope and magnetometer. Source: Troubleshooting: Unstable yaw (aka heading aka azimuth) readings / Yaw drift. After calibrating the sensors, my yaw values are correct.

Going back to the original problem of wrong co-ordinate system, I applied these corrections to the code in imu_node.py to fix it:

  1. subodh-malgonde@bf06e02
  2. subodh-malgonde@457f7aa
  3. subodh-malgonde@0c0aa56

UPDATE 2: It turns out IMUs measure acceleration opposite of gravitational acceleration in the static state. Please see these posts:

  1. IMU convention for robot_localization
  2. Why do 3-axis accelerometers seemingly have a left-handed coordinate system?
  3. IMU data to be used with robot_localization

So the razor_imu_9dof package provides data in the right format. No changes are required to the code.

@lebarsfa Your suspicion was right about the negated accelerations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants