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

Global Planner's Costmap Empty

asked 2018-04-18 20:26:20 -0500

Troski gravatar image

updated 2018-04-26 00:24:50 -0500

Hello Everyone,

I am currently trying to get the global_planner to create path. The problem I am having is that the planner is creating paths through obstacles, and static map. I followed the tutorial on setting up the navigation stack, and also other forums posts with similar issues 1 2 3.

Here are my YAML configuration files:

global_costmap_params.yaml:

global_costmap:
      global_frame: /map
      robot_base_frame: base_link
      update_frequency: 5.0
      publish_frequency: 5.0
      static_map: true
      rolling_window: false
      resolution: 0.05
      always_send_full_costmap: true

plugins:
      - {name: static,           type: "costmap_2d::StaticLayer"}
      - {name: obstacles,        type: "costmap_2d::ObstacleLayer"}
      - {name: inflation,        type: "costmap_2d::InflationLayer"}

costmap_common_params.yaml

obstacle_range: 2.5
raytrace_range: 3.0
footprint: [[0.1, 0.1],[-0.1,-0.1],[0.1,-0.1],[-0.1,0.1]]
footprint_padding: 0.1
resolution: 0.05
inflation_radius: 0.1
update_frequency: 5.0
publish frequency: 5.0
transform_tolerance: 2.0

static:
 map_topic: /map
 subscribe_to_updates: true


observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: laser, data_type: LaserScan, topic: /scan, marking: true, clearing: true}

Here is the launch file for the global_planner:

<launch>
  <!-- planner -->
  <node pkg="global_planner" type="planner" name="global_planner">
  <remap from="/global_planner/goal" to="/move_base_simple/goal"/>
  <rosparam file="/home/nvidia/rc_car/JetsoNavigation/Navigation_ws/param/costmap_common_params.yaml" command="load" />
  <rosparam file="/home/nvidia/rc_car/JetsoNavigation/Navigation_ws/param/global_costmap_params.yaml" command="load" />
  </node>
</launch>

This is how the costmap from the global planner looks like:

rviz at launch

after running rqt_reconfigure, and adjusting the origin of the global_costmap, I am able to generate paths on the global planner, but it plans through obstacles.

Here I am running the example from the costmap_2d package, and it is picking up the static map, and obstacles from the lidar.

costmap from example in costmap_2d package

This is how the config file for the costmap_2d example looks like:

global_frame: /map
robot_base_frame: base_link
update_frequency: 5.0
publish_frequency: 1.0

#set if you want the voxel map published
publish_voxel_map: true

#set to true if you want to initialize the costmap from a static map
static_map: true

#begin - COMMENT these lines if you set static_map to true
#rolling_window: true
#width: 3.0
#height: 3.0
#resolution: 0.025
#end - COMMENT these lines if you set static_map to true

#START VOXEL STUFF
map_type: voxel
origin_z: 0.0
z_resolution: 0.2
z_voxels: 10
unknown_threshold: 10
mark_threshold: 0
#END VOXEL STUFF

transform_tolerance: 0.3
obstacle_range: 2.5
max_obstacle_height: 2.0
min_obstacle_height: 0.0
raytrace_range: 3.0
footprint: [[-0.13, -0.08], [-0.13, 0.08], [0.13, 0.08], [0.13, -0.08]]
#robot_radius: 0.46
footprint_padding: 0.01
inflation_radius: 0.3
cost_scaling_factor: 10.0
lethal_cost_threshold: 100
observation_sources: base_scan
base_scan: {data_type: LaserScan, expected_update_rate: 0.4, sensor_frame: laser, topic: /scan,
            observation_persistence: 0.0, marking: true, clearing: true  } #, max_obstacle_height: 0.4, min_obstacle_height: 0.0}

When I echo on console /global_planner/costmap/costmap it looks mostly empty with some exceptions.

When I launch amcl, I can see on the map server console that it is sending a map; however when I launch the global planner I don't see that output on the console. This means the global_planner is not getting the costmap from the map_server?

I am not ... (more)

edit retag flag offensive close merge delete

Comments

Can you please add a screenshot of the global costmap in rviz? Also the indention of "plugins" in "global_costmap_params.yaml" is too far left. It should be under "global_costmap". Don't know if this is a copy & paste problem here or exist in your real files.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-04-19 01:35:17 -0500 )edit

The indentation comes from the formatted text button. I just added the rviz images! Thank you for your feedback!

Troski gravatar image Troski  ( 2018-04-19 02:34:08 -0500 )edit

The first picture does show the map topic, but not the global costmap. Please add the launch file. In costmap_common_params.yaml observation_sources should be under "obstacles:" btw.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-04-21 08:26:18 -0500 )edit

The /global_planner/costmap/costmap is publishing but for some reason is imcomplete. also on the dynamic reconfig, the static layer is missing in the global_planner, but is shows on the costmap_2d example. I tried using the same file used in the costmap_2d but still I get the same problem.

Troski gravatar image Troski  ( 2018-04-23 02:17:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-25 23:56:26 -0500

Troski gravatar image

updated 2018-04-25 23:59:04 -0500

Finally got it to work, as it turns out I had to go inside the global planner's node code to see that the costmap used there is called "costmap" and not "global_costmap" as shown in the tutorial. when it comes to the yaml parameters file you have to use the right name. Here is what I mean:

Parameters file loaded onto global planner.

costmap: #This name is the name of the costmap, and needs to match the one given in the code
  global_frame: /map
  robot_base_frame: base_link
  update_frequency: 5.0
  publish_frequency: 1.0

#set if you want the voxel map published
  publish_voxel_map: true

#set to true if you want to initialize the costmap from a static map
  static_map: true

#begin - COMMENT these lines if you set static_map to true
#rolling_window: true
#width: 3.0
#height: 3.0
#resolution: 0.025
#end - COMMENT these lines if you set static_map to true

#START VOXEL STUFF
  map_type: voxel
  origin_z: 0.0
  z_resolution: 0.2
  z_voxels: 10
  unknown_threshold: 10
  mark_threshold: 0
#END VOXEL STUFF

  transform_tolerance: 0.3
  obstacle_range: 2.5
  max_obstacle_height: 0.4
  min_obstacle_height: 0.0
  raytrace_range: 3.0
  footprint: [[-0.13, -0.08], [-0.13, 0.08], [0.13, 0.08], [0.13, -0.08]]
#robot_radius: 0.46
  footprint_padding: 0.01
  inflation_radius: 0.3
  cost_scaling_factor: 10.0
  lethal_cost_threshold: 100
  observation_sources: base_scan
  base_scan: {data_type: LaserScan, expected_update_rate: 0.4, sensor_frame: laser, topic: /scan,
            observation_persistence: 0.0, marking: true, clearing: true, max_obstacle_height: 0.4, min_obstacle_height: 0.0}

main file of the global_planner:

int main(int argc, char** argv) {
    ros::init(argc, argv, "global_planner");

    tf::TransformListener tf(ros::Duration(10));

    costmap_2d::Costmap2DROS lcr("costmap", tf); 

    global_planner::PlannerWithCostmap pppp("planner", &lcr);

    ros::spin();
    return 0;
}

Parameters file suggested on the example:

global_costmap: #this name doesn't match the name of the costmap in the code, therefore this does nothing.
  global_frame: /map
  robot_base_frame: base_link
  update_frequency: 5.0
  static_map: true

I would like to give credit to this answer for hinting about the name of the costmaps being relevant, on the tutorial there is no mention of this.

edit flag offensive delete link more

Comments

I don't think the tutorial is wrong here, I also have the global costmap under the global_costmap namespace. I believe there is something else wrong here. I just currently don't see it.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-04-26 02:20:33 -0500 )edit

that's what made the global planner work. before it wasn't reading the static map, neither the laser feedback. with that file if you change "costmap" to something else it wont work, same if you change the name of the lcr object in the globla_planner node... it makes sense....

Troski gravatar image Troski  ( 2018-04-26 03:32:15 -0500 )edit

I see now that you have updated the question and that you directly launch the planner without move_base. This is a setup which I don't have any clue about, so no idea whats correct.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2018-04-26 04:18:39 -0500 )edit

Yeah what I was trying to do was to launch the global planner without move_base ... I think move_base does some stuff to the namespaces and makes them match properly. anyways, this solution works fine. I'll make a tutorial for this.

Troski gravatar image Troski  ( 2018-04-26 19:20:04 -0500 )edit

Hi, I get the same problem but with very low frequency. I can see the global costmap in rviz, but the global planner give me a path through the obstacles in the global costmap. I think the bug is in the costmap_2d_publisher.cpp, where publish the costmap to topic. But now, I don't get the slover and the bug is really not easy to re-appear.Do you have re-appear the bug with your methods?

yueweiliang gravatar image yueweiliang  ( 2019-03-12 02:54:40 -0500 )edit

You have to make sure that the names for the costmaps are consistent. I found that the tutorial was a bit misleading, you need to make sure the global planner uses the global costmap by having the names of the costmaps matching on the yaml files.

Troski gravatar image Troski  ( 2019-04-15 10:51:34 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-04-18 20:12:43 -0500

Seen: 1,900 times

Last updated: Apr 26 '18