Move base stay at max speed

asked 2019-10-10 04:11:36 -0500

Jérémy_Synergize gravatar image

updated 2019-10-10 09:50:05 -0500

Hi, I'm trying to use the navigation package for ros on a virtual robot in gazebo and I have some troubles.

(Using Ros-kinetic, move_base package, gmapping SLAM, diff drive control)

The problem seems to be that when the nav sends a linear x speed to cmd_vel, he never put it back to 0, so the robot rushes forward until he hit a wall (or fall over, depending on the max speed). I don't understand if that comes from the nav package (a bad config ? ) or from the controller package.

The path showed in rviz seems correct, and he tries to correct his trajectory when he goes too far, but he doesn't seem capable of slowing down or move backward. I am new on ros, and I don't really know where to look :/ I use everything in launch file and yaml config. (don't know how much I need to send, so tell me if you need more ) Thanks :)

dummy_navigation.launch :

include file="$(find dummy_description)/launch/amcl.launch.xml"
arg name="cmd_vel_topic" default="cmd_vel" 
arg name="odom_topic" default="/robot/odom_diffdrive"
arg name="move_forward_only" default="true"

node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen"

<param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS"/>

<rosparam file="$(find dummy_description)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find dummy_description)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find dummy_description)/param/local_costmap_params.yaml" command="load"/>
<rosparam file="$(find dummy_description)/param/global_costmap_params.yaml" command="load"/>
<rosparam file="$(find dummy_description)/param/move_base_params.yaml" command="load"/>
<rosparam file="$(find dummy_description)/param/dwa_local_planner_params.yaml" command="load"/>
<remap from="cmd_vel" to="$(arg cmd_vel_topic)"/>
<remap from="odom" to="$(arg odom_topic)"/>
<param name="DWAPlannerROS/min_vel_x" value="0.0" if="$(arg move_forward_only)" />


dwa_local_planner DWAPlannerROS: max_vel_x: 0.5 min_vel_x: -0.88

 max_vel_y: 0.0 # diff drive robot
 min_vel_y: 0.001 # diff drive robot
 max_trans_vel: 0.88
 min_trans_vel: -0.2
 max_rot_vel: 0.08
 min_rot_vel: -0.05

 acc_lim_x: 0.1
 acc_lim_y: 0.0
 acc_lim_theta: 0.01

 yaw_goal_tolerance: 0.15
 xy_goal_tolerance: 0.2

 sim_time: 5.0
 vx_samples: 8
 vy_samples: 0
 vtheta_samples: 2
 controller_frequency: 20.0

path_distance_bias: 32.0
goal_distance_bias: 20.0
occdist_scale: 0.02
forward_point_distance: 0.325
stop_time_buffer: 0.2
scaling_speed: 0.25
max_scaling_factor: 0.2
oscillation_reset_dist: 0.05

publish_traj_pc: true
publish_cost_grid_pc: true
 global_frame_id: odom

Diff driver inside xacro :

  <plugin name="diff_drive_controller" filename="">

robot_controle.yaml :

# Publish all joint states -----------------------------------
type: joint_state_controller/JointStateController
publish_rate: 50  

type        : "diff_drive_controller/DiffDriveController"
left_wheel : 'wheel_left_joint'
right_wheel : 'wheel_right_joint'
publish_rate: 50.0               # default: 50
pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]

# Wheel separation and diameter. These are both optional.
# diff_drive_controller ...
edit retag flag offensive close merge delete


Why do you need the diff_drive_controller if you are using move_base? Also how are you giving goals?
Try using only move_base. The computed cmd_vels should come only from the local_planner DWAPlannerROS.

pavel92 gravatar image pavel92  ( 2019-10-10 04:57:01 -0500 )edit

I give a goal with rviz. The diff_drive_controller is the one creating Odom, without that don't work :/

Where should odom be generate if the diff drive is replaced by move base? And I'm not sure if I have a DWAPlannerROS, is it inside the move_base or did I need to add it somewhere else?

Thanks for your help.

Jérémy_Synergize gravatar image Jérémy_Synergize  ( 2019-10-10 05:17:45 -0500 )edit

Which robot are you using? I am not sure if you can use diff_drive_controller as odometry provider for the navigation stack.You should receive odometry from localization. From what you have posted I can see that you are using amcl. You can also check robot_localization package.
jackal_navigation also gives a good example for navigation configuration for a diff drive robot.

pavel92 gravatar image pavel92  ( 2019-10-10 05:51:53 -0500 )edit

I will try with the packages you mention and I will come back to you. The robot is a self-made, with 2 wheels, 2 balls (for balance), and (for now ) one lidar. Because his structure is similar I based a lot of my try on the turtlebot.

Jérémy_Synergize gravatar image Jérémy_Synergize  ( 2019-10-10 06:45:32 -0500 )edit

I added robot_localization and it seems to work, (I got an odom, and the position looks correct), but I am not able to move the robot anymore (I guess the diff drive was the one doing all the work. ), how I'm supposed to have move_base actually set to move the robot ? Did the "mobile_base_controller" in my robot_control.yaml is still useful or was its link to the gazebo plugin?

Jérémy_Synergize gravatar image Jérémy_Synergize  ( 2019-10-10 08:01:06 -0500 )edit

I would not use the robot controllers (diff_drive_controller) at all. The local planner from move_base should compute the cmd_vels. Make sure you revert the remap from:

arg name="odom_topic" default="/robot/odom_diffdrive"
pavel92 gravatar image pavel92  ( 2019-10-10 08:25:12 -0500 )edit

I would not use the robot controllers (diff_drive_controller) at all.

@pavel92: which node would be responsible for converting Twists into wheel velocities then?

gvdhoorn gravatar image gvdhoorn  ( 2019-10-10 08:26:36 -0500 )edit

My move_base sends the cmd_vel , but I have nothing to translate then and make the robot move. I think I forget to add something obvious which does this.

Jérémy_Synergize gravatar image Jérémy_Synergize  ( 2019-10-10 08:31:43 -0500 )edit