0
$\begingroup$

Rosanswers logo

I am trying to localize my robot (Gazebo model) in a known map. The robot has a lidar and IMU on it. To start with I tried visualizing the robot_localization estimate in rviz. I am feeding only IMU data to the ekf estimator. I did not expect the Odometry estimate to be very accurate, however even when the robot is not moving the estimate generated by robot_localization keeps on moving. Also the estimate covariance keeps on increasing (this can be observed in rviz). What could possibly be going wrong?


I am publishing a static transform to place the map frame at the odom frame. Here is how my tf tree looks like (only relevant part shown):

image description

This is the robot_localization configuration:

frequency: 30
sensor_timeout: 0.05
two_d_mode: true
transform_time_offset: 0.0
transform_timeout: 1.0
print_diagnostics: false
debug: false
publish_tf: true
publish_acceleration: false

odom_frame: odom
base_link_frame: base_footprint
world_frame: odom

imu0: /imu

imu0_config: [false, false, false,
              false,  false,  true,
              false, false, false,
              false,  false,  true,
              true,  false,  false]

imu0_nodelay: false
imu0_differential: false
imu0_relative: true
imu0_queue_size: 5
imu0_pose_rejection_threshold: 0.8
imu0_twist_rejection_threshold: 0.8
imu0_linear_acceleration_rejection_threshold: 0.8

imu0_remove_gravitational_acceleration: true

dynamic_process_noise_covariance: true

process_noise_covariance: [ sample values from robot_localization github repo]

initial_estimate_covariance: [ value of 0.01 for variables set to true in imu0_config]

Here are the ROS IMU plugin settings:

<gazebo reference="base_imu_link">
    <gravity>true</gravity>
    <sensor name="razor_9dof_imu" type="imu">
        <always_on>true</always_on>
        <update_rate>100</update_rate>
        <topic>/imu</topic>
        <plugin filename="libgazebo_ros_imu_sensor.so" name="imu_plugin">
            <topicName>/imu</topicName>
            <bodyName>base_imu_link</bodyName>
            <updateRateHZ>100</updateRateHZ>
            <gaussianNoise>0.05</gaussianNoise>
            <xyzOffset>0 0 0</xyzOffset>
            <rpyOffset>0 0 0</rpyOffset>
            <frameName>base_imu_link</frameName>
        </plugin>
        <pose>0 0 0 0 0 0</pose>
    </sensor>
</gazebo>

Here is the IMU data:

header: 
  seq: 1791
  stamp: 
    secs: 37
    nsecs: 148000000
  frame_id: "base_imu_link"
orientation: 
  x: 0.0246637627368
  y: -0.026593164317
  z: 0.0668625611945
  w: 1.02289534517
orientation_covariance: [0.0025000000000000005, 0.0, 0.0, 0.0, 0.0025000000000000005, 0.0, 0.0, 0.0, 0.0025000000000000005]
angular_velocity: 
  x: -0.0326675653364
  y: -0.0340936938196
  z: -0.0323116318276
angular_velocity_covariance: [0.0025000000000000005, 0.0, 0.0, 0.0, 0.0025000000000000005, 0.0, 0.0, 0.0, 0.0025000000000000005]
linear_acceleration: 
  x: -0.0783367912198
  y: -0.00500801404049
  z: 9.79784343093
linear_acceleration_covariance: [0.0025000000000000005, 0.0, 0.0, 0.0, 0.0025000000000000005, 0.0, 0.0, 0.0, 0.0025000000000000005]

Originally posted by Subodh Malgonde on ROS Answers with karma: 512 on 2018-08-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Initially I thought this was happening due to sensor noise. So I made it zero and it still made no difference.

I set imu0_remove_gravitational_acceleration to false and this made the problem go away. I don't understand why this should make a difference when I have set two_d_mode to true. The IMU is oriented such that when the robot is not moving the X & Y accelerations are zero and Z acceleration is 9.8 m/s^2. In 2D mode, it should ignore the Z acceleration and make no adjustments to the X & Y accelerations. However this does not seem to be the case.

This solves my problem, however I would like to understand the significance of imu0_remove_gravitational_acceleration in 2D mode.


Originally posted by Subodh Malgonde with karma: 512 on 2018-08-23

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by MH1117 on 2018-09-22:
Hi Malgonde, I'm using the same sensor you have "IMU Razor 9dof" But i faced issues with creating its model by creating the link and joint and searching for IMU plugin, But it didn't work ,May you help me with this issue,please?

Comment by Subodh Malgonde on 2018-09-23:
What do you mean by it did not work? Did you try rostopic list to check if IMU is publishing data on some topic? My plugin code is there in the OP. The link and joint code would be too long to post as a comment. Please post a separate question and send me the link. I'll answer on that.

$\endgroup$

Your Answer

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