configuring DWA navigation correctly

asked 2022-03-04 09:33:50 -0500

RH56 gravatar image

updated 2022-03-04 09:37:23 -0500

I am wrestling to get the DWA planner work (Noetic, Ros1)

Things that already work:

  • My C++ code generates transforms and RViz accepts them without errors

  • With the 2D-Nav_Goal arrow in Rviz, I can make a path and the navigator generates twist commands

    I checked that driving forward corresponds with positive x velocity, and a counterclockwise curve corresponds with a positive rotation z.

  • In my Rviz settings: FixedFrame = map, ReferenceFrame = FixedFrame, Map = /map, LocalPlanner =
    move_base/DWAPlanner/ROS/local_plan, LocalCostmap =
    /move_base/local_costmap/costmap,
    GlobalPlanner =
    /move_base/DWAPlanner/ROS/global_plan, Laser = /scan.

I am having configuration problems:

.1 The navigation does not obey the max velocities I define in: my_costmap_common_params.yaml and the navigator generates twist messages with both x and y velocities although I have set holonomic_robot to false (differential robot cannot drive sidewise). What is the correct file and way to define these parameters so that DWA Planner gets it?

my_base_local_planner_params.yaml:

TrajectoryPlannerROS:
  max_vel_x: 0.20
  min_vel_x: -0.20
  max_vel_y: 0.0
  min_vel_y: 0.0
  max_vel_theta: 0.4
  min_in_place_vel_theta: 0.4

  acc_lim_theta: 0.5
  acc_lim_x: 0.5
  acc_lim_y: 0.5

  holonomic_robot: false

my_move_base.launch:

    <launch>
       <master auto="start"/>
     <!-- Run the map server --> 
        <node name="map_server" pkg="map_server" type="map_server" args="$(find robot)/maps/mymap.pgm 0.1"/>

        <include file="$(find amcl)/examples/amcl_diff.launch" />    

       <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
         <rosparam file="$(find robot)/config/my_costmap_common_params.yaml" command="load" ns="global_costmap" /> 
         <rosparam file="$(find robot)/config/my_costmap_common_params.yaml" command="load" ns="local_costmap" />
         <rosparam file="$(find robot)/config/my_local_costmap_params.yaml" command="load" />
         <rosparam file="$(find robot)/config/my_global_costmap_params.yaml" command="load" /> 
         <rosparam file="$(find robot)/config/my_base_local_planner_params.yaml" command="load" />   

        <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />  
        <param name="controller_frequency" value="5.0" />
        <param name="controller_patience" value="15.0" />   
      </node>  
   <!-- from ROS call Rviz with config settings at the local file: -->
   <node name="rviz" pkg="rviz" type="rviz" args="-d $(find robot)/config/my_rviz.rviz" required="true" />
</launch>

.2: sometimes after a while in Rviz, RobotFootprint goes in error: "For frame [odom]: No transform to fixed frame[map]". Anything wrong or incomplete in my configuration? This error only happens sometimes. my_costmap_common_params.yaml:

obstacle_range: 2.0
raytrace_range: 3.0
footprint: [[-0.3, -0.4], [-0.3, 0.36], [0.3, 0.36], [0.3, -0.4]]
#robot_radius: 0.35
inflation_radius: 0.2
observation_sources: laser_scan_sensor point_cloud_sensor
laser_scan_sensor: {sensor_frame: laser, data_type: LaserScan, topic: scan, marking: true, clearing: true}
edit retag flag offensive close merge delete

Comments

In my_base_local_planner_params.yaml try changing the first line to DWAPlannerROS instead of TrajectoryPlannerROS.

tryan gravatar image tryan  ( 2022-03-04 19:06:50 -0500 )edit

Thanks, Tryan. No, the footprint error still occurs now and then. But there is a difference: When I put my max higher than 0.1, it gives 0.1m/s velocities in x, but when I put my max lower than 0.1, Rviz won't make a path. So it looks like the planner is now influenced by my_base_local_planner_params.yaml, which was not the case before. Other strange thing is that I receive alternately zero velocities and 0.1m/s velocities, so that the robot shocks forward. Could there be any timing problem I need to reconfigure somewhere?

RH56 gravatar image RH56  ( 2022-03-05 08:46:53 -0500 )edit

You now have your local planner parameters in the right namespace (DWAPlannerROS), where move_base can find them. The alternating velocities can happen if there are more than one publisher on the /cmd_vel topic. One way to check is rotopic info /cmd_vel.

tryan gravatar image tryan  ( 2022-03-05 11:27:06 -0500 )edit

I had already left out my joystick launch to avoid such conflict, but here is the result: rostopic info /cmd_vel reacts with only: publishers * /move_base, which is OK (I guess), as the navigation stack is supposed to publish. When I do: rostopic echo /cmd_vel, nothing happens until I make a path in Rviz. Then zero-speed messages alternated with 0.1m/s-speed messages pass by. After a while, Robot Footprint goes in error and then it stops.

RH56 gravatar image RH56  ( 2022-03-07 13:32:49 -0500 )edit

Yes, move_base should be the only node publishing to /cmd_vel. The alternating speeds may be a result of tuning, but it seems odd. What is the environment like?

The transform error between odom and map is likely a problem with localization. Just to confirm, AMCL is the only localization/SLAM software you have running, right? If so, does it fail just before navigation does, or does your robot continue to localize effectively after throwing that error?

tryan gravatar image tryan  ( 2022-03-07 14:05:56 -0500 )edit

Hi, Tryan. I think I just discovered the core of the problem. When I do a rostopic echo /scan, I see my rplidar producing correct data for a few minutes and then it suddenly stops. That very moment also the mentioned footprint error comes up in Rviz. When I run my rplidar alone (without the navigation stack) the same happens, the message stream just stops after a while. So it looks there is some weird sync problem between my Rplidar_A3 and ROS. Furthermore, when I run with Rviz and I look at "LaserScan", sometimes in a very short flash an error comes up: "Transform, sender unknown". I am going to redefine my problem in a new question, because it looks like my navigation stack is configured correctly and that the problem lies somewhere in the lidar-Ros communication.

RH56 gravatar image RH56  ( 2022-03-09 03:18:28 -0500 )edit

That does sound like the source of the map->odom transform issue, and making it a separate question seems appropriate. I'm glad you're getting things figured out! To close this question, you can summarize your findings in an answer, or I can do it if you prefer.

tryan gravatar image tryan  ( 2022-03-10 08:40:01 -0500 )edit

Hi, Tryan, after having solved some problems on the laser, there is one main issue remaining which I described in https://answers.ros.org/question/3976... Once this problem is solved, I expect the robot to navigate correctly.

RH56 gravatar image RH56  ( 2022-03-17 06:53:10 -0500 )edit