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

How to Connect Wheel encoder to ROS computer

asked 2016-01-04 07:40:30 -0500

Terry Su gravatar image

updated 2016-01-04 07:41:19 -0500

Hello ROS users,

If I have a wheel encoder(Vehicle's hall sensor), and I want to input the signal to my ROS computer. But there is no information about it. Does anyone know that? Do I need to use the other board to receive that? I will be thankful if someone can give me some direction. Thanks in advanced.

edit retag flag offensive close merge delete



More information please: What "other board" are you talking about?

Usually one has to convert the hardware specific hall sensor into a ros /odom message.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2016-01-04 08:12:39 -0500 )edit

@Humpelstilzchen, such as this arduino board. Because I don't have the specific hall sensor for ROS but my case just need to input the signal of hall sensor and Gyro...etc., so I need a interface to input these sensor signals. Thanks.

Terry Su gravatar image Terry Su  ( 2016-01-04 20:58:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-05 00:27:27 -0500

Humpelstilzchen gravatar image

updated 2016-01-05 12:34:08 -0500

In this case you have to convert encoder ticks into nav_msgs/Odometry Messages. Take a look at navigation/Tutorials/RobotSetup/Odom in the wiki to basically understand what is required.

Which might be (there a multiple options available):

  1. Find out what needs to be done to convert the information from your hall sensors into a position. This is very robot specific.
  2. Port the code from the wiki to your arduino on your robot using rosserial to publish the Odometry. Rosserial is of course only one way to connect an arduino to your PC, but you should try it.

Depending on your vehicle you might also be able to use the differential_drive package.

If you publish both, the position of your lidar relative to the robot and the position of the robot as tf tf (as described in the Odometry tutorial), then yes, you also have the position of the lidar in the odom frame and rviz will display it properly.

edit flag offensive delete link more


@Humpelstilzchen If I use arduino board to get the hall sensor and I also launch the lidar, and then connect to the rviz, when I move the wheels and because the effect of the hall sensor, the location of my in the rviz will move,too?

Terry Su gravatar image Terry Su  ( 2016-01-05 05:43:17 -0500 )edit

I have the same doubt. Will the location move too?

mateusguilherme gravatar image mateusguilherme  ( 2019-01-30 14:19:44 -0500 )edit

What location? Please note that this is a three year old question. Better open a new one.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2019-01-30 14:26:57 -0500 )edit

Question Tools



Asked: 2016-01-04 07:40:30 -0500

Seen: 5,823 times

Last updated: Jan 05 '16