Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, I have the same problem. It seems, when you use range_sensor_layer, other layers just disconnected for turtlebot3. I am not sure, just guessing. I fix this problem by adding other layers manually:

global_costmap_params.yaml

plugins:
      - {name: static_layer, type: "costmap_2d::StaticLayer"}
      - {name: sonar, type: "range_sensor_layer::RangeSensorLayer"}
      - {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
      - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

obstacle_layer:
    observation_sources: scan
    scan: {sensor_frame: base_scan, data_type: LaserScan, topic: scan, marking: true, clearing: true}

  sonar:
    topics: ["/sonar_front"]
    clear_on_max_reading: true

local_costmap_params.yaml

plugins:
      - {name: static_layer, type: "costmap_2d::StaticLayer"}
      - {name: sonar, type: "range_sensor_layer::RangeSensorLayer"}
      - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

sonar:
    topics: ["/sonar_front"]

However, then you have to specify parameters for those layers because they have default values. For example, in costmap_common_params.yaml

#Obstacle marking parameters
obstacle_range: 1.8
max_obstacle_height: 2.0
raytrace_range: 2.0

#Cost function parameters
inflation_radius: 3.0
cost_scaling_factor: 10.0

#The cost at which a cell is considered an obstacle when a map is read from the map_server
lethal_cost_threshold: 100

For other parameters search ros wiki.