I am using this ROS2 driver to connect my MPU6050 to RPi 4 running ROS2 humble. It outputs an IMU message containing linear acceleration and angular velocity. The linear acceleration values seem to be gyroscope values, as they change when I tilt the robot but not when the robot accelerates in X,Y or Z. But I want X and Y acceleration values for Ros2 robot_localization via ekf, how would I get that. Is that an issue with this driver, or a problem with MPU6050? Thanks I am a beginner.

Edit: I get the values described in the robot_localization wiki:

Acceleration: Be careful with acceleration data. The state estimation nodes in robot_localization assume that an IMU that is placed in its neutral right-side-up position on a flat surface will: Measure +9.81 9.81 meters per second squared for the Z Z axis. If the sensor is rolled +90 90 degrees (left side up), the acceleration should be +9.81 9.81 meters per second squared for the Y Y axis. If the sensor is pitched +90 90 degrees (front side down), it should read -9.81 9.81 meters per second squared for the X X axis.

But I don’t understand how this works. When I pitch the robot forward, it goes forward faster and faster in RViz. And when moving around it eventually drifts because of this. Why is linear_acceleration providing me angular values? Perhaps it is measuring the acceleration forces on the robot but this would change when the robot is pitch/rolled so how does the EKF properly control for changes in pitch and roll?

  • $\begingroup$ Can you edit your question to provide the data that convinced you that the values are not what you're expecting? $\endgroup$
    – Tully
    Mar 17, 2023 at 18:08
  • $\begingroup$ @Tully I edited my comment. I’m getting the right values but have a hard time understanding how these values are used to determine position of the robot, if pitch and roll affects these values. $\endgroup$
    – Redstone
    Mar 21, 2023 at 3:37


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.