ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

odometry question

asked 2015-03-24 07:35:31 -0500

maha gravatar image

hello, in the navigation stack, the publishing odometry part. where those values should come from? 16 double vx = 0.1; 17 double vy = -0.1; 18 double vth = 0.1;

from this code:

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-24 08:52:01 -0500

updated 2015-03-25 12:18:51 -0500

The paragraph below the breakdown of that line of code states:

Here we'll set some velocities that will cause the "base_link" frame to move in the "odom" frame at a rate of 0.1m/s in the x direction, -0.1m/s in the y direction, and 0.1rad/s in the th direction. This will more or less cause our fake robot to drive in a circle.

Basically the robot will move those amounts with every time step.

nav_msgs/odometry messages take the following form:

# This represents an estimate of a position and velocity in free space.  
# The pose in this message should be specified in the coordinate frame given by header.frame_id.
# The twist in this message should be specified in the coordinate frame given by the child_frame_id
Header header
string child_frame_id
geometry_msgs/PoseWithCovariance pose
geometry_msgs/TwistWithCovariance twist

You can find information concerning geometry_msgs here.

In a real situation, a robot driver, like p2os or turtlebot, will extract the position and velocity information (or data from the motor encoders) and will produce the nav_msgs/odometry. If you have built your own robot, you will have to create a node which extracts motor encoder data and publishes the nav_msgs/odometry. Take a look at other robot's driver_nodes for an example.

edit flag offensive delete link more



my question is that those three variables are set in this example as an arbitrary values. if i wanna really implement it then those values should come from a sensor or so right? where do they come from?

maha gravatar image maha  ( 2015-03-24 09:17:05 -0500 )edit

Absolutely right. Those values are an arbitrary value to demonstrate how to publish a nav_msgs/Odometry message over ROS and a transform using tf for a robot.

I have a Pioneer3-DX robot and the p2os_driver node takes encoder information from the robot and publishes the odom message to ROS.

sealguy77 gravatar image sealguy77  ( 2015-03-24 13:00:53 -0500 )edit

ok so what are those encoder information exactly? what should i put in the x,y, and th from the encoder?

maha gravatar image maha  ( 2015-03-24 13:25:14 -0500 )edit

Depending on your robot, there may be a driver which does that for you.

However, if you built your own, you will have to calculate your robot's odometry information.

sealguy77 gravatar image sealguy77  ( 2015-03-24 13:39:03 -0500 )edit

distance = (left_encoder + right_encoder) / 2.0

theta = (left_encoder - right_encoder) / WHEEL_BASE

X_position = distance * sin(theta) Y_position = distance * cos(theta)

For help, take a look here:

sealguy77 gravatar image sealguy77  ( 2015-03-24 13:39:56 -0500 )edit

ok thank u.. my controller is Roboteq SDC21xx and yes it has a driver but I don't know how to use it. do u recommend to do it manually or do I have to learn how to use the driver sooner or later? THANK U

maha gravatar image maha  ( 2015-03-25 08:20:09 -0500 )edit

That is your controller, but what are you using for your robot platform? Is it commercial-off-the-shelf or did you build it? My platform is the Pioneer3-DX and it is connected to my controller (SlimPro675p) by serial connection.

sealguy77 gravatar image sealguy77  ( 2015-03-25 09:41:12 -0500 )edit

no it is not commercial-off-the-shelf.. i got my platform from SuperDroid Robotics. and got me this controller.

maha gravatar image maha  ( 2015-03-25 10:07:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-24 07:35:31 -0500

Seen: 494 times

Last updated: Mar 25 '15