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

Suggest a wheel encoder

asked 2016-09-12 08:06:15 -0600

b-sriram gravatar image

updated 2016-09-12 08:06:34 -0600


I want to buy wheel encoders to fix with the wheels of a car.

Can anyone suggest simple encoders that they have already bought and interfaced with ROS?

It would be of great help if you could share your code too?

Thanks & Regards Sriram

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-13 00:31:03 -0600

Mark Rose gravatar image

The simplest setup is to use motors with wheel encoders built-in, or motors for which stock encoder modules exist. Barring that, the best setup is if you have access to the back shaft of the motor (before the gearing). You should be able to set up an optical or Hall-effect encoder on that side.

If you have an actual car and want encoders for the wheels, you could either go an optical route, with some sensor mounted on the axle looking at stripes mounted on the wheels somehow, or perhaps Hall-effect magnetic sensors. But if you have an actual car, you might find it easier to read the existing odometer cable and combine that with the amount of steering to infer the pose changes.

edit flag offensive delete link more


Hi Mark,

Thanks for the answer. Yes as you said reading the odometry cable is the bes choice but unfortunately that is not an option I have. I'm working with an actual electric car, so its powered my a motor with an built-in ecoder. Will reading that give me an accurate distance measurement?

b-sriram gravatar image b-sriram  ( 2016-09-13 05:25:19 -0600 )edit

I'll write a program to calucate the distance using the encoder ticks. Or should I use a seperate encoder as you suggested and interface it with the backshaft?

b-sriram gravatar image b-sriram  ( 2016-09-13 05:26:52 -0600 )edit

If you have access to the motor encoders, that would be best. I have mostly worked on differential-drive systems, so there is a simple strategy for using both encoders. I presume your car has Ackerman drive. The math is different, but if you have steering, then slippage should be small.

Mark Rose gravatar image Mark Rose  ( 2016-09-13 14:38:23 -0600 )edit

As far as using the encoders, you'll get two bits of input, call them A and B. They will cycle through 00-->01-->11-->10-->00, or the opposite order. If you concatenate the old and new inputs into a single 4-bit value, you can do if-else or switch to determine whether to increment or decrement.

Mark Rose gravatar image Mark Rose  ( 2016-09-13 14:46:18 -0600 )edit

Alternatively, if you get interrupts only on changes to the A input, then code like this will suffice (or might have the wrong sense, depending on your wiring):

if (A == B) {
} else {

There are also packages to do this, depending on your hardware.

Mark Rose gravatar image Mark Rose  ( 2016-09-13 14:49:41 -0600 )edit

Hi, Thanks a lot again. I'll first look into to the encoders and try to code them as you suggested and get back to you when I have some results

b-sriram gravatar image b-sriram  ( 2016-09-14 03:15:15 -0600 )edit

One more thing: your motor controller may already be reading the encoder inputs, and there may be a way of reading a cumulative value from the controller. (Don't know anything about your hardware, of course.)

Mark Rose gravatar image Mark Rose  ( 2016-09-14 10:15:52 -0600 )edit

Hi Mark,

really sry for the late reponse. I finally got to know more abt the controller. It is a Curtis 1236 motor controller and it is communicated with curtis 1314 programming software which uses VCL. Coming back to your question, yes the encoders are already connected to the controller.

b-sriram gravatar image b-sriram  ( 2016-10-04 03:36:04 -0600 )edit

Question Tools



Asked: 2016-09-12 08:06:15 -0600

Seen: 920 times

Last updated: Sep 13 '16