# odometry manually

hello, i need to publish the odometry information over ROS with my own robot platform (SuperDroid platform) and i'm using Roboteq SDC21xx microcontroller. the thing is that in this code http://wiki.ros.org/navigation/Tutorials/RobotSetup/Odom there are three variables that I have to provide which are 16 double vx = 0.1; 17 double vy = -0.1; 18 double vth = 0.1; Now, my question is if i provided the values and computations of the variables manually. which unit measures should I use? inches/s ? radians? how?

thank u

Originally posted by maha on ROS Answers with karma: 27 on 2015-03-25

Post score: 0

Comment by maha on 2015-03-25:
yea and why do i have to provide the wheels size i dont get it

Comment by 2ROS0 on 2015-03-25:
Why don't you follow the standard msg type for odom msgs? You can decide what units you want to send them in though as long as the node receiving the msg is aware of that.

vx, vy, and vz are in meters/sec. vth is in radians/second.

Take a look at this site.

To get distance, and therefore (x,y) position, you will have to know wheel circumference. Encoder counts gives you how much the motor has turned, but if that motor is attached to a larger wheel, then the distance will obviously be greater.

Example:

If your robot was just riding on the motor shafts and your motor shafts were 0.04 m in circumference. If you rotated your motor one full rotation, you will have traveled 0.04 m.

However, if your motor shaft was fixed to a wheel with a circumference of 0.25 m and you rotated your motor one full revolution, then you will have traveled 0.25m (ignoring friction and drag).

Originally posted by sealguy77 with karma: 323 on 2015-03-25

This answer was ACCEPTED on the original site

Post score: 1

Comment by maha on 2015-03-26:
ok thank u

Comment by maha on 2015-03-30:
now that i got the distance traveled for x and y . i'll have to set vx to x and vy to y. correct?

Comment by sealguy77 on 2015-04-06:
You will get vx and vy from the encoders as well. The rate they are turning, giving you velocity in the x (usually set as forward) and y (usually set as robot's left) directions.

You usually command the motors to turn using /cmd_vel.

Comment by sealguy77 on 2015-04-06:
I think for the purpose of the tutorial you mentioned, they just set vx and vy as an example to show the base_link moving in the odom frame. You wouldn't actually put that when publishing your odometry message.

But I could be wrong. I haven't had to do that from scratch yet.