ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Why there is a linear_acceleration in X direction for non moving imu 9250?

asked 2020-08-25 13:31:40 -0500

Ahmed_Desoky gravatar image

updated 2020-08-25 13:45:35 -0500

I am using mpu9250 by the package /jeskesen/i2c_imu and the launch file is:

<?xml version="1.0"?>
<launch>
    <node pkg="tf" type="static_transform_publisher" name="imu_to_base" 
    args="0 0 0 0 0 0 base_link imu_link 50" /> 
<!--
    <node name="i2c_imu_node" pkg="i2c_imu" type="i2c_imu_node" ns="imu" output="screen">
        <param name="imu_frame" value="imu_link" />
    -->
    <node name="i2c_imu_node" pkg="i2c_imu" type="i2c_imu_node"  output="screen">
        <param name="imu_frame" value="imu_link" />

    <param name="i2c_bus" value="1" />

    <param name="i2c_slave_address" value="104" />
    <!--imu_type:
        0 = Auto discover
        1 = Null (used when data is provided from a remote IMU
        2 = InvenSense MPU-9150
        3 = STM L3GD20H + LSM303D
        4 = STM L3GD20 + LSM303DLHC
        5 = STM LSM9DS0
        6 = STM LSM9DS1
        7 = InvenSense MPU-9250
        8 = STM L3GD20H + LSM303DLHC
        9 = Bosch BMX055
        10 = Bosch BNX055
    -->
    <param name="imu_type" value="7" />

    <!--fusion_type:
        0 = RTFUSION_TYPE_NULL: just a dummy to keep things happy if not needed
        1 = RTFUSION_TYPE_KALMANSTATE4: kalman state is the quaternion pose
        2 = RTFUSION_TYPE_RTQF: RT quaternion fusion
    -->
    <param name="fusion_type" value="2" />

    <!-- mpu9250/gyro_accel_sample_rate: 5 - 1000 Hz --> 
    <param name="mpu9250/gyro_accel_sample_rate" value="80" />

    <!-- mpu9250/compass_sample_rate: 1 - 100 Hz -->
    <param name="mpu9250/compass_sample_rate" value="40" /> 

    <!-- mpu9250/gyro_low_pass_filter:
        0x11 - 8800Hz, 0.64mS delay
        0x10 - 3600Hz, 0.11mS delay
        0x00 - 250Hz, 0.97mS delay
        0x01 - 184Hz, 2.9mS delay
        0x02 - 92Hz, 3.9mS delay
        0x03 - 41Hz, 5.9mS delay
        0x04 - 20Hz, 9.9mS delay
            0x05 - 10Hz, 17.85mS delay
            0x06 - 5Hz, 33.48mS delay
        -->
        <param name="mpu9250/gyro_low_pass_filter" value="3" />

        <!-- mpu9250/accel_low_pass_filter:
            0x00 - 460Hz, 1.94mS delay
            0x01 - 184Hz, 5.80mS delay
            0x02 - 92Hz, 7.80mS delay
            0x03 - 41Hz, 11.80mS delay
            0x04 - 20Hz, 19.80mS delay
            0x05 - 10Hz, 35.70mS delay
            0x06 - 5Hz, 66.96mS delay
        -->
        <param name="mpu9250/accel_low_pass_filter" value="3" />

        <!-- mpu9250/gyro_full_scale_range:
            0 +/- 250 degress per second
            8 +/- 500 degress per second
            16 +/- 1000 degress per second
            24 +/- 2000 degress per second
        -->
        <param name="mpu9250/gyro_full_scale_range" value="16" />

        <!-- mpu9250/accel_full_scale_range:
            0 +/- 2g
            8 +/- 4g
            16 +/- 8g
            24 +/- 16g
        -->
        <param name="mpu9250/accel_full_scale_range" value="16" />
    </node>
</launch>

the imu doesn't move, but the output is:

---
header: 
  seq: 2685
  stamp: 
    secs: 1598377876
    nsecs: 786975020
  frame_id: "imu_link"
orientation: 
  x: 0.0196061972529
  y: -0.100331619382
  z: 0.19570158422
  w: 0.975320518017
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: -0.000253986567259
  y: -0.000782979652286
  z: 0.000762287527323
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration: 
  x: 1.93930334473
  y: 0.0191536132812
  z: 9.28710823975
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---

Why there is a linear_acceleration in X direction x=1.9 ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-08-25 15:48:13 -0500

praskot gravatar image

updated 2020-08-25 15:48:54 -0500

If you see the norm of the linear_acceleration, norm(x: 1.93930334473, y: 0.0191536132812, z: 9.28710823975) = 9.4874, (reasonable). Also, as you see the orientation is not exactly [0,0,0,1], the linear acceleration value in X-direction is the component of gravity in the x-direction. Note, IMU gives you the acceleration in the body-frame. Hopefully, the following img might convey it better,

image description

edit flag offensive delete link more

Comments

that is right, Thank you for your reply.

But how to calibrate the imu to remove linear_acceleration: in x and y direction (when the imu in horizontal and level position)?

Ahmed_Desoky gravatar image Ahmed_Desoky  ( 2020-08-26 00:04:05 -0500 )edit

Find the rest-state orientation (say q0), and rotate the accelerometer reading by that amount.

accel_corrected = q0*accel_measured*q0c, where q0c is the quaternion conjugate and * is the quaternion multiplication.

For the given values, you have

q0 = [0.975320518017, 0.0196061972529, -0.100331619382, 0.19570158422]
accel_meas = [0, 1.93930334473, 0.0191536132812, 9.28710823975]
q0c = [0.975320518017,-0.0196061972529,0.100331619382,-0.19570158422]
accel_corrected = [0,-0.002,0.03047,9.4874]

Also, don't forget to normalize and scale it to 9.81.

praskot gravatar image praskot  ( 2020-08-26 00:35:46 -0500 )edit

can you help me in this problem? link text

Ahmed_Desoky gravatar image Ahmed_Desoky  ( 2020-08-26 02:46:30 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-08-25 13:31:40 -0500

Seen: 243 times

Last updated: Aug 25 '20