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

[Navigation stack] A question about move_base

asked 2014-08-31 16:22:38 -0600

Andromeda gravatar image

updated 2014-09-01 02:35:30 -0600

As stated here, the move_base package is going to compute the velocity to publish on /cmd_vel in order to drive the robot to reach the goal (if present). In the tutorial about Navigation stack there an example on "How to publish Odometry Transform". But looking at the file the author is going to define some variables for velocity and position:

  12   double x = 0.0;
  13   double y = 0.0;
  14   double th = 0.0;
  15 
  16   double vx = 0.1;
  17   double vy = -0.1;
  18   double vth = 0.1;

integrating them later in a loop:

  30     //compute odometry in a typical way given the velocities of the robot
  31     double dt = (current_time - last_time).toSec();
  32     double delta_x = (vx * cos(th) - vy * sin(th)) * dt;
  33     double delta_y = (vx * sin(th) + vy * cos(th)) * dt;
  34     double delta_th = vth * dt;
  35 
  36     x += delta_x;
  37     y += delta_y;
  38     th += delta_th;

Now, my question is:

  • are those variable necessary in the file just to give the reader an idea on how to move the robot using odometry? And they MUST be removed when the robot is receiving data over /cmd_vel form the move_base? Since they are integrating above time in the loop they are going to put wrong cmd_vel information to the robot (in my opinion). Or are they necessary in any case?
  • What about if the robot is going to be simulated? Since I dn t have any odometry source I should create some data. Are in this case those variables necessary?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-08-31 18:56:38 -0600

ahendrix gravatar image

Yes; the vx, vy and vth values in the tutorial are samples, and should be replaced with real encoder data when using a real robot.

Note that the tutorial you linked to is publishing odometry messages, not cmd_vel, and that odometry represents the position feedback from the wheel sensors, not a command to move the robot.

edit flag offensive delete link more

Comments

Hendrix: if you look at line 69 to 72 it is going to publish velocity as well. odom.twist.twist.linear....

Andromeda gravatar image Andromeda  ( 2014-09-01 01:29:58 -0600 )edit

No. Those lines are setting the velocity estimate within the Odometry message. It's still part of the Odometry message and published on the odom topic, not cmd_vel

ahendrix gravatar image ahendrix  ( 2014-09-01 01:58:05 -0600 )edit

Ok, but you said: not a command to move the robot. Reading the tutorial one gets the impression that odometry information is used to updated the new position of the robot, then braodcasted over ROS and then move_base use that informations to calculate /cmd_vel. Many times uses the word "velocity"

Andromeda gravatar image Andromeda  ( 2014-09-01 02:39:46 -0600 )edit

The Odometry represents the current state of the robot: position and speed. move_base calculates a new velocity command based on the current speed, position, acceleration limits, obstacles and goal of the robot.

ahendrix gravatar image ahendrix  ( 2014-09-01 03:22:09 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-08-31 16:22:38 -0600

Seen: 915 times

Last updated: Sep 01 '14