D.3 Costmap 2D

Costmap 2D ကတော့ robot environment ( ပတ်ဝန်းကျင်အနေအထား ) ကိုဖေါ်ပြဖို့ နဲ့ ကျတော်တို့ သုံးထားတဲ့ sensor တွေကို ဖေါ်ပြဖို့အတွက် ဖန်တီးထားတဲ့ package ပေါ့။ 2D gird-based costmap ကိုအသုံးပြုပါတယ်။ သူ့ကို planner တို့ controller server တို့က လမ်းကြောင်းတွက်ချက်ခြင်း နဲ့ ထိခိုက်မှုတွေ မဖြစ်အောင် ရှောင်ရှားဖို့ တွက်ချက်တဲ့ နေရတာတွေမှာ သုံးရပါတယ်။

သူ့မှာ ချိန်ညှိပေးလို့ရတဲ့ parameter စာရင်းတွေကတော့ ဒီလိုပါ။

Name
Description
Type
Default

always_send_full_costmap

Whether to send full costmap every update, rather than updates

bool

FALSE

footprint_padding

Amount to pad footprint (m).

double

0.01

footprint

Ordered set of footprint points passed in as a string, must be closed set. For example, the following defines a square base with side lengths of 0.2 meters footprint: “[ [0.1, 0.1], [0.1, -0.1], [-0.1, -0.1], [-0.1, 0.1] ]”. footprint အတိုင်းတာကို အပြင်က square အတိုင်းတာဘဲထားထားမယ်

vector <double>

"[]"

global_frame

Reference frame.

string

"map"

height

hight of costmap(m)

int

5

width

width of costman(m)

int

5

lethal_cost_threshold

Minimum cost of an occupancy grid map to be considered a lethal obstacle. obstacle ဘေးမှ grid တန်ဖိုးအတိုးလျော့

int

100

map_topic

Topic of map from map_server or SLAM. map ကိုထုတ်ပေးနေတဲ့ topic name ထညိ့ရန်

sting

map

observation_sources

List of sources of sensors as a string, to be used if not specified in plugin specific configurations. Ex. “static_layer stvl_layer” plugin ထည့်သွင်းမထားတဲ့ sensors တွေကို ထည့်သွင်းချင်ရင် သုံးရန်

sting

""

origin_x

X origin of the costmap relative to width (m).

double

0.0

origin_y

y origin of the costmap relative to height (m).

double

0.0

publish_frequency

Frequency to publish costmap to topic.

double

1.0

resolution

Resolution of 1 pixel of the costmap, in meters.

double

0.1

robot_base_frame

robot base frame

sting

"base_link"

robot_radius

Robot radius to use, if footprint coordinates not provided.

double

0.1

rolling_window

Whether costmap should roll with robot base frame.

bool

FALSE

track_unknown_space

If false, treats unknown space as free space, else as unknown space.

bool

FALSE

transform_tolerance

TF transform tolerance.

double

0.3

trinary_costmap

If occupancy grid map should be interpreted as only 3 values (free, occupied, unknown) or with its stored values.

bool

TRUE

unknown_cost_value

Cost of unknown space if tracking it.

int

255

update_frequency

Costmap update frequency.

double

5

use_maximum

whether when combining costmaps to use the maximum cost or override.

bool

FALSE

plugins

List of mapped plugin names for parameter namespaces and names.

vector <string>

{“static_layer”, “obstacle_layer”, “inflation_layer”}

filter

List of mapped costmap filter names for parameter namespaces and names.

vector <string>

{}

အောက်ဆုံးနားမှာ plugins တွေကို ဘယ်လို define လုပ်ပြီးထည့်ထားတာလဲဆိုတော့

local_costmap:
  ros__parameters:
    plugins: ["obstacle_layer", "voxel_layer", "inflation_layer"]
    obstacle_layer:
      plugin: "nav2_costmap_2d::ObstacleLayer"
    voxel_layer:
      plugin: "nav2_costmap_2d::VoxelLayer"
    inflation_layer:
      plugin: "nav2_costmap_2d::InflationLayer"

နောက် filter ဆိုတာကလဲ plugin ပါပဲ။ costmap ပေါ်မှာ မတူအောင် နှစ်ခုခွဲထားတဲ့သဘောပဲ။

local_costmap:
  ros__parameters:
    filters: ["keepout_filter", "speed_filter"]
    keepout_filter:
      plugin: "nav2_costmap_2d::KeepoutFilter"
    speed_filter:
      plugin: "nav2_costmap_2d::SpeedFilter"

Parameter တွေကို static layer အတွက် parameter , inflation layer အတွက် obstacle layer, voxel layer, range sensor layer, denoise layer စသဖြင့် သက်ဆိုင်ရာ parameter အသီးသီးရှိကြပြီး အစအဆုံးအားလုံးပေါင်းရေးတဲ့အခါ အောက်ကမျိုး parameter တွေပါတဲ့ yaml ဖိုင်ကိုရရှိပါတယ်။

global_costmap:
  global_costmap:
    ros__parameters:
      footprint_padding: 0.03
      update_frequency: 1.0
      publish_frequency: 1.0
      global_frame: map
      robot_base_frame: base_link
      use_sim_time: True
      robot_radius: 0.22 # radius set and used, so no footprint points
      resolution: 0.05
      plugins: ["static_layer", "obstacle_layer", "voxel_layer", "inflation_layer"]
      obstacle_layer:
        plugin: "nav2_costmap_2d::ObstacleLayer"
        enabled: True
        observation_sources: scan
        footprint_clearing_enabled: true
        max_obstacle_height: 2.0
        combination_method: 1
        scan:
          topic: /scan
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          max_obstacle_height: 2.0
          min_obstacle_height: 0.0
          clearing: True
          marking: True
          data_type: "LaserScan"
          inf_is_valid: false
      voxel_layer:
        plugin: "nav2_costmap_2d::VoxelLayer"
        enabled: True
        footprint_clearing_enabled: true
        max_obstacle_height: 2.0
        publish_voxel_map: True
        origin_z: 0.0
        z_resolution: 0.05
        z_voxels: 16
        max_obstacle_height: 2.0
        unknown_threshold: 15
        mark_threshold: 0
        observation_sources: pointcloud
        combination_method: 1
        pointcloud:  # no frame set, uses frame from message
          topic: /intel_realsense_r200_depth/points
          max_obstacle_height: 2.0
          min_obstacle_height: 0.0
          obstacle_max_range: 2.5
          obstacle_min_range: 0.0
          raytrace_max_range: 3.0
          raytrace_min_range: 0.0
          clearing: True
          marking: True
          data_type: "PointCloud2"
      static_layer:
        plugin: "nav2_costmap_2d::StaticLayer"
        map_subscribe_transient_local: True
        enabled: true
        subscribe_to_updates: true
        transform_tolerance: 0.1
      inflation_layer:
        plugin: "nav2_costmap_2d::InflationLayer"
        enabled: true
        inflation_radius: 0.55
        cost_scaling_factor: 1.0
        inflate_unknown: false
        inflate_around_unknown: true
      always_send_full_costmap: True


local_costmap:
  local_costmap:
    ros__parameters:
      update_frequency: 5.0
      publish_frequency: 2.0
      global_frame: odom
      robot_base_frame: base_link
      use_sim_time: True
      rolling_window: true
      width: 3
      height: 3
      resolution: 0.05

Last updated