ENSTABretagneRobotics / razor_imu_9dof

A ROS driver and firmware to connect to Sparkfun OpenLog Artemis, 9DoF Razor IMU M0, 9DOF Razor IMU and 9DOF Sensor Stick. These boards consists of 3 sensors: magnetic, gyro and acceleration sensor.
BSD 3-Clause "New" or "Revised" License
92 stars 114 forks source link

Added support of SEN-14001 (9DoF Razor IMU M0) #34

Closed lebarsfa closed 6 years ago

lebarsfa commented 6 years ago

Resolves #28. The firmware modifications to support the M0 were originally made from the latest version of https://github.com/Razor-AHRS/razor-9dof-ahrs, forked in https://github.com/lebarsfa/razor-9dof-ahrs. Then, the ROS-specific modifications from https://github.com/KristofRobot/razor_imu_9dof were added to add ROS compatibility. Finally, following a suggestion on https://answers.ros.org/question/261398/sparkfun-9dof-razor-imu-sen-14001/, this pull request is proposed, and a pull request to https://github.com/Razor-AHRS/razor-9dof-ahrs will be proposed soon...

fabolhak commented 6 years ago

Hello, thank you for this contribution. It really helped us a lot using the SEN-14001 in our project :). I just have one question: There is this accel_factor which is in the Arduino code 250 and in the ROS code 256.

Is this on purpose or a mistake? I get better results when using 256 in the Arduino code as well.

lebarsfa commented 6 years ago

Glad to know that it helped!

For the coefficient, it was on purpose, but that does not prevent it to be a mistake...

From what I understand of the different pieces of code, the 256 in ROS code is needed due to the #define GRAVITY 256.0f in Razor_AHRS.ino and the 250 added in Sensors.ino is supposed to compensate the 250 in Razor_AHRS.ino used for default calibration values.

Here is what should happen :

If this is correct, I would say that your better results with 256 could be probably obtained equivalently without modifying the code, by modifying your accelerometers calibration values ACCEL_X_MIN, ACCEL_X_MAX, etc.

Let me know if there is something wrong...

fabolhak commented 6 years ago

Hello, thank you for the quick reply and the detailed explanation. At first I was skeptical, because of the hardcoded default calibration parameter 250. But I also did the calculation with different values and the mathematics seem to be correct.

So probably my calibration wasn't the best.

Thank you again :)

KristofRobot commented 6 years ago

@lebarsfa - I am merging this, although I have no way to test this myself. However, I am relying on the testing of @tyzaizl and @fabolhak

Thank you for your contribution!