Robotics StackExchange | Archived questions

Robot Localization with Odometry and UM7

Hello all,

I am trying to get localization to work for a custom car like robot.

I am able to publish odom from wheel encoders and imu/data from my UM7 imu sensor.

I would like to fuse together these two data using the robot localization package and then show it with baselink in rviz. Without proper localization of baselink, I will not be able to run the navigation stack properly.

In my current setup, rviz is able to show forward and backward movement with base_link; however, when I manually rotate the um7 imu sensor, it does not reflect within rviz. I can see that the odometry/filtered topic is receiving input from the um7 but how do i visualize this in rviz?

My end goal is to place this um7 on my custom car like robot. I want rviz to display the base_link mimicking its real life counterpart in terms of position/orientation and velocities (moving forward/backward, turing left/right...etc). It is to my understanding that this is what the robot localization package is for, please correct my understanding if i am making a mistake.

Here are two videos describing my problem:

1st video shows the screen recording from my computer. You can see that moving forward and backward is okay, but I do not know how to turn the base_link.

2nd video shows what I am trying to do

Below is the configuration file for the robot_localization package:

frequency: 50
sensor_timeout: 0.1
two_d_mode: true
transform_time_offset: 0.0
transform_timeout: 0.0
print_diagnostics: true
debug: false

debug_out_file: /path/to/debug/file.txt

publish_tf: true

publish_acceleration: false

odom_frame: odom            # Defaults to "odom" if unspecified
base_link_frame: base_link  # Defaults to "base_link" if unspecified
world_frame: odom           # Defaults to the value of odom_frame if unspecified

odom0: /odom

odom0_config: [false,  false,  false,
               false, false, true,
               true, true, false,
               false, false, true,
               false, false, false]

odom0_queue_size: 2

odom0_nodelay: false

odom0_differential: false

odom0_relative: false


odom0_pose_rejection_threshold: 5
odom0_twist_rejection_threshold: 1

imu0: /imu/data
imu0_config: [false, false, false,
              false,  false,  true,
              false, false, false,
              false,  false,  true,
              false,  false,  false]
imu0_nodelay: false
imu0_differential: false
imu0_relative: true
imu0_queue_size: 5
imu0_pose_rejection_threshold: 0.8                 # Note the difference in parameter names
imu0_twist_rejection_threshold: 0.8                #
imu0_linear_acceleration_rejection_threshold: 0.8  #

imu0_remove_gravitational_acceleration: true

use_control: true

stamped_control: false

control_timeout: 0.2

control_config: [true, false, false, false, false, true]

acceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 3.4]

deceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 4.5]

acceleration_gains: [0.8, 0.0, 0.0, 0.0, 0.0, 0.9]

deceleration_gains: [1.0, 0.0, 0.0, 0.0, 0.0, 1.0]

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]


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]

Asked by aarontan on 2018-09-10 18:34:13 UTC

Comments

Have you calibrated the IMU? Calibrating individual sensors (accelerometer, gyroscope, magnetometer) is important for proper functioning of the IMU.

Asked by Subodh Malgonde on 2018-09-11 00:53:49 UTC

Also before you fuse the IMU data with robot_localization can you visualize IMU attitude and heading, something like this https://user-images.githubusercontent.com/5463437/43065886-c729e4c2-8e80-11e8-8d47-905032444590.gif. I am using the Razor IMU and its github repo comes with a visualization tool.

Asked by Subodh Malgonde on 2018-09-11 00:55:08 UTC

@Subodh Malgonde yes I have calibrated it and I can see the imu/data published. The UM7 does not have a visualization tool like the razor. In your application, when you fuse together odometry with imu data, are you able to complete what I stated as my end goal? (base_link motion mimicking real lif

Asked by aarontan on 2018-09-11 08:25:43 UTC

Yes I am able to do that. One suggestion, before you try it on the actual hardware you should try simulating a wheel encoder + IMU in Gazebo, by setting sensor noise to zero. That way you will know if something is wrong with your robot_localization config.

Asked by Subodh Malgonde on 2018-09-12 00:04:04 UTC

@aarontan could you help me by guiding me how were you able to generate odometry data from wheel encoders?

Asked by Raza Jafri on 2020-08-12 03:01:28 UTC

Answers

A couple things.

  1. Please get rid of all the advanced parameters, such as the rejection thresholds. Also turn of use_control. Those really are meant for advanced usage. What I typically recommend is that you start with a single sensor and a simple config, then work your way up.
  2. Looking at your configuration, you are fusing yaw as an absolute pose variable from your odometry and from the IMU. So let's say your wheel odometry says you have a yaw of 0. Then you pick up your IMU and rotate it. Now you have one data source that reads 0, and another that reads non-zero. I would expect the filter to settle on a value in between them, but it really depends on your covariances. You may also have an issue with your IMU data.

You didn't include sample sensor messages, so I can't comment on whether your IMU and wheel encoder data need any changes, but certainly issue (2) above would be a big problem.

Asked by Tom Moore on 2018-10-24 10:11:52 UTC

Comments