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

How does robot_localization package work and what should the output be?

asked 2017-09-19 10:37:57 -0500

Vinh K gravatar image

I am planning to use the robot_localization package but I am not sure what the output should be or how should the performance be? I need to use GPS for navigation.

edit retag flag offensive close merge delete


Have you read its wiki?

jayess gravatar image jayess  ( 2017-09-19 15:58:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-19 18:52:49 -0500

M@t gravatar image

updated 2017-09-27 15:36:34 -0500

Hi Vinh K! As @jayess said, the best place to start is the wiki page. If you want to get something up and running quickly I suggest you look at the example launch files and their corresponding configuration files

If you want to know how robot_localization produces a position estimate, it follows the standard process for the Extended Kalman Filter (EKF) and Unscented Kalman Filter (UKF). You're best to read the relevant literature on those topics, and read the associated paper here.

If you are using a GPS outdoors, then the output you care about will be topic labelled /odometry/filtered_map. This is a ROS odometry message and is the position of your robot relative to the reference frame /map, which will be created when you launch the localization nodes, and will be placed at the current position of your robot. Essentially /odometry/filtered_map is the position and orientation of your robot relative to its starting point.

Regarding performance, this will depend on your sensors. I'm using a high-accuracy GPS and I can get the position of my robot to within +/- 2 cm if its moving, less if it's stationary. If accuracy is important to you, I've found that the UKF is more accurate than the EKF.

ROS and robot_localization

The way to learn how robot_localization works is to thoroughly read the wiki, and (because you're using GPS) specifically this page here. But I'll give you a short(ish) overview. I won't make any assumptions about how much you or anyone reading this later knows, so apologises if this repeats stuff you already understand:

ROS navigation/localization packages revolve around three key frames:

  1. /base_link This frame is rigidly attached to your robot, and basically represents the robot's position and orientation in 3D space.
  2. /odom This represents your local frame of reference. Motion of /base_link relative to this frame is expected to be continuous (i.e. no discrete jumps) and localization packages that fuse data in this reference frame generally only fuse wheel odometry and IMU data, hence why the robot's position relative to /odom drifts over time.
  3. /map This represents your global reference frame. Motion of /base_link relative to this frame will generally be more accurate and won't drift over time.

The purpose of robot_localization is to create the /odom and /map reference frames, and create an odometry message that gives the position of /base_link (i.e. your robot) relative to these frames. To do this, robot_localization uses three separate nodes which can be created by running the template launch files, as described in the template launch file:

This launch file provides an example of how to work with GPS data using robot_localization. It runs three nodes:

(1) An EKF instance that fuses odometry and IMU data and outputs an odom-frame state estimate

(2) A second EKF instance that fuses the same data, but also fuses the transformed GPS data from (3)

(3) An instance of navsat_transform_node, which takes in ...

edit flag offensive delete link more


thanks M@t. The reason I ask was because I went through their wiki but it is not step by step and what output we should get to know that the vehicle is localized after using the package.

Vinh K gravatar image Vinh K  ( 2017-09-20 10:26:02 -0500 )edit

I don't fully understand your question sorry. Do you mean an output which tells you that the package has calculated the position of the robot? (i.e. localized it). The robot will be localized as soon as the EKF or UKF starts publishing odometry messages (a second after running the launch files)

M@t gravatar image M@t  ( 2017-09-20 15:44:20 -0500 )edit

I have read through the documentation. But without what output I should expect. I can not determine how it behaves. I have tested it on Gazebo simulator using Husky. I ran 2 nodes 1. ukf_localization_node 2. navsat_transform_node

Vinh K gravatar image Vinh K  ( 2017-09-20 16:05:28 -0500 )edit

after running navsat_transform_node, I saw initial odometry pose is origin: (6.30098376362836485, 2.28487938934057466384658 0) and Rotation (RPY)....

Vinh K gravatar image Vinh K  ( 2017-09-20 16:07:08 -0500 )edit

back to your question, yes. How do I know if the robot position is calculated? and the sensors from GPS, IMU, Odometry is fused to estimate the position. What should I look for? I did not run launch files. I only run the node files above.

Vinh K gravatar image Vinh K  ( 2017-09-20 16:09:20 -0500 )edit

If you're just using robot_localization, you'll need to run two EKF or UKF nodes, a local and a global one. If you run the launch files you should see them and navsat_transform listed when you use rostopic list.

M@t gravatar image M@t  ( 2017-09-20 21:53:07 -0500 )edit

You'll know the position of your robot has been calculated as soon as the EKF/UKF nodes start publishing an odometry message. How familiar are you with the relationship between /base_link, /odom, /map reference frames and the ROS navigation stack?

M@t gravatar image M@t  ( 2017-09-20 21:54:57 -0500 )edit

I have not use it that much. But I understand what those are.

Vinh K gravatar image Vinh K  ( 2017-09-25 23:47:07 -0500 )edit

Question Tools



Asked: 2017-09-19 10:37:57 -0500

Seen: 4,050 times

Last updated: Sep 27 '17