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

Revision history [back]

click to hide/show revision 1
initial version

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

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. 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.