Robotics StackExchange | Archived questions

Using wheel encoders and IMU with robot_localization

Hi all,

I am using wheelencoders which is giving odometry information of the type `navmsgs/Odometryand IMU which givessensormsgs/IMU(IMU is giving orientation, angular velocity and linear acceleration). I am using them with [robot_localization](http://wiki.ros.org/robot_localization). It seems to be working but when I save a bag file and then run it and visualize the odom (from thewheelencoders) and the odometry output ofrobotlocalization, they seem off and they start diverging under the settings shown in the launch file below. Here is the link to the [video](https://youtu.be/4k5htqfe3i0) (Red arrow represents odometry fromwheelencodersand Blue arrow represents output odometry fromrobot_localization`).

ekfrobotlocalization.launch

<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" clear_params="true">

   <param name="frequency" value="10"/>

   <param name="sensor_timeout" value="0.5"/>

   <param name="two_d_mode" value="true"/>

   <param name="map_frame" value="map"/>
   <param name="odom_frame" value="odom_combined"/>
   <param name="base_link_frame" value="base_footprint"/>
   <param name="world_frame" value="odom_combined"/>

   <param name="transform_time_offset" value="0.0"/>

  <param name="odom0" value="odom"/>
  <param name="imu0" value="imu_data"/>

  <rosparam param="odom0_config">[false,false, false,
                                  false, false, false,
                                  true, true, false,
                                  false, false, true,
                                  false, false, false]</rosparam>

  <rosparam param="imu0_config">[false, false, false,
                                 false, false, false,
                                 false, false, false,
                                 false, false, true,
                                 false, false, false]</rosparam>

  <param name="odom0_differential" value="false"/>
  <param name="imu0_differential" value="false"/>

  <param name="print_diagnostics" value="true"/>

  <param name="debug"           value="false"/>
  <param name="debug_out_file"  value="debug_ekf_localization.txt"/>

  <rosparam param="process_noise_covariance">[0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0.06, 0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0.025, 0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0.025, 0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0.04, 0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0.01, 0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0.01, 0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0.02, 0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0.01, 0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0.01, 0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0.015]</rosparam>

   <rosparam param="initial_estimate_covariance">[1e-9, 0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    1e-9, 0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    1e+9, 0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    1e+9, 0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    1e+9, 0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    1e+9, 0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    1e+9,  0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     1e+9,  0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     1e-9,  0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     1e+9, 0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    1e+9, 0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    1e+9]</rosparam>

</node>

In the above case, wheel_encoders odometry and output filtered odometry of robot_localization is off meaning they diverge. Is this behavior normal? Also, If I use x,y,yaw from wheel_encoders odometry (differential = false) and vyaw from IMU (differential = false), odometry from wheel_encoders overlaps perfectly with the output of robot_localization.

Also, If I just use wheel_encoders odometry in robot_localization (no IMU), its odometry overlaps perfectly with the odometry output of robot_localization (obviously).

I am just trying to understand why is this happening and what is causing it and what are best settings for the above case? Can someone pitch in with their ideas?

Thanks in advance.
Naman Kumar

Asked by Naman on 2015-10-29 14:04:14 UTC

Comments

"...they seem off under the settings shown in the launch file..."

By "off," are you referring to the fact that the paths diverge?

Asked by Jim Rothrock on 2015-10-29 19:46:13 UTC

Yes.. The paths (from wheel encoders and the output of the robot_localization) diverge!

Asked by Naman on 2015-10-31 09:08:58 UTC

Hi Mr. @Naman . Could you please help me how to merge ımu and encoder data?

Asked by Mekateng on 2018-06-07 03:46:00 UTC

Answers

The robot_localization path diverges from the encoder path because the robot_localization path includes data from the IMU. The robot_localization path might actually be closer to the robot's true path than the encoder path. Generally, the odometry path generated by wheel encoders will diverge from a robot's true path by some amount, and the path generated from IMU measurements will diverge by some other amount. robot_localization merges the data from the encoders and the IMU, generating a path that, ideally, is closer to the true path than the encoder or IMU paths alone.

Asked by Jim Rothrock on 2015-11-03 15:25:45 UTC

Comments