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

odometry question

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

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: http://wiki.ros.org/navigation/Tutori...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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

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

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

Comments

1

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 -0600 )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 -0600 )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 -0600 )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 -0600 )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: http://www.geology.smu.edu/~dpa-www/r...

sealguy77 gravatar image sealguy77  ( 2015-03-24 13:39:56 -0600 )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 -0600 )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 -0600 )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 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 626 times

Last updated: Mar 25 '15