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

How to Publish Odometry to use with Hector SLAM

asked 2016-06-24 09:00:41 -0500

Emilien gravatar image

updated 2016-06-29 03:58:18 -0500

Procópio gravatar image

I want to add odometry to Hector SLAM. I have arduino and pololu shield motor with 2 gear motors with encoders. I found ros_arduino_bridge package which contain my shield motos but i don't know how to use it and connect it with hector slam. could you help me?

edit retag flag offensive close merge delete


do you already have an /odom topic being published or that is what you want to achieve?

Procópio gravatar image Procópio  ( 2016-06-28 04:47:29 -0500 )edit

that is what i want to achieve

Emilien gravatar image Emilien  ( 2016-06-28 08:55:09 -0500 )edit

ok, I will edit your question to better reflect what you want.

Procópio gravatar image Procópio  ( 2016-06-29 03:56:44 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-06-28 01:52:43 -0500

Procópio gravatar image

updated 2016-06-29 03:56:16 -0500

to use hector slam you need a laser scanner or other sensor that provides data that could be transformed to a laser scan message, as an RGBD camera, for example.


First of all, you need to have in mind that odometry information is not a part of Hector SLAM, but an information that can be used by several other ROS nodes, including Hector SLAM. As a matter of fact, Hector SLAM can work without odometry (check this question, for example)

So, putting aside the Hector SLAM, this is the tutorial you are looking for:

In short, you need to create an odometry message and and odometry tf. The content is pretty much the same, but the odometry message also has information about your robot's velocity. Anyway, the tutorial is quite clear and easy to follow.

In your specific case, you will need to get the information from your encoders to calculate the velocity of each wheel, so you can populate your odometry message. Note that in the sample code, this values are fixed, and you must change them to use what you are measuring from your encoders.

edit flag offensive delete link more


i think you don't understand me, i use already hector slam with laser scan. now i want to add odometry ...

Emilien gravatar image Emilien  ( 2016-06-28 02:23:03 -0500 )edit

@Emilien how did youn do this?

femitof gravatar image femitof  ( 2020-05-10 13:24:17 -0500 )edit

Who and why did accept this answer ! I cannot relate it to the question which seeks obtaining Odometry from Hector_Slam. Any update ?

zlg9 gravatar image zlg9  ( 2021-08-04 09:49:02 -0500 )edit

@zlg9 The question wasn't regarding obtaining odometry from Hector SLAM, but to add an odometry source to Hector SLAM. As for your question, you can subscribe to /poseupdate and use it to publish the odom->base_link transformation.

Pedro Leal gravatar image Pedro Leal  ( 2021-08-13 09:13:23 -0500 )edit

Question Tools

1 follower


Asked: 2016-06-24 09:00:41 -0500

Seen: 1,562 times

Last updated: Jun 29 '16