[Navigation stack] A question about move_base
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