Bird
Raised Fist0
ROSframework~10 mins

Costmap configuration (static, obstacle, inflation) in ROS - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Costmap configuration (static, obstacle, inflation)
Start
↓
Load Static Map
↓
Detect Obstacles
↓
Apply Inflation
↓
Generate Final Costmap
↓
Use Costmap for Navigation
The costmap is built by loading a static map, detecting obstacles, inflating their areas, and then producing the final map for robot navigation.
Execution Sample
ROS
static_map:
  enabled: true
obstacle_layer:
  enabled: true
inflation_layer:
  inflation_radius: 0.55
This config enables the static map, obstacle detection, and sets inflation radius to expand obstacle areas.
Execution Table
StepActionStatic Map LoadedObstacles DetectedInflation AppliedResulting Costmap
1Load static map from fileYesNoNoBase map with static environment
2Detect obstacles from sensorsYesYesNoMap with obstacles marked
3Apply inflation around obstaclesYesYesYesMap with inflated obstacle zones
4Final costmap ready for navigationYesYesYesComplete costmap with safe zones
💡 All layers loaded and processed, costmap ready for robot use
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
static_map_loadedfalsetruetruetruetrue
obstacles_detectedfalsefalsetruetruetrue
inflation_appliedfalsefalsefalsetruetrue
costmap_stateemptystatic mapmap + obstaclesmap + inflated obstaclesfinal costmap
Key Moments - 3 Insights
Why do we apply inflation after detecting obstacles?
Inflation expands obstacle areas to create safe buffer zones. This happens after obstacles are detected (see execution_table step 3) to ensure the robot keeps a safe distance.
What if the static map is not loaded?
Without the static map (execution_table step 1), the costmap has no base environment, so obstacle detection and inflation won't work properly.
Does inflation change the original obstacle positions?
No, inflation does not move obstacles but adds a safety margin around them (execution_table step 3), making the robot avoid nearby areas.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step are obstacles first detected?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Check the 'Obstacles Detected' column in the execution_table rows.
According to variable_tracker, what is the state of 'inflation_applied' after step 2?
Afalse
Btrue
Cundefined
Dpartially true
💡 Hint
Look at the 'inflation_applied' row and the 'After Step 2' column in variable_tracker.
If inflation radius is increased, how would the 'Resulting Costmap' change at step 3?
AObstacle zones become smaller
BNo change to obstacle zones
CObstacle zones become larger
DStatic map is replaced
💡 Hint
Inflation expands obstacle areas; see execution_table step 3 description.
Concept Snapshot
Costmap config loads a static map,
detects obstacles from sensors,
then inflates obstacles to add safety margins.
Inflation radius controls buffer size.
Final costmap guides robot navigation safely.
Full Transcript
In ROS navigation, the costmap is built step-by-step. First, the static map is loaded to provide a base environment. Next, obstacles are detected using sensor data and marked on the map. Then, inflation is applied to expand obstacle areas, creating safe buffer zones around them. This prevents the robot from getting too close to obstacles. The final costmap combines all these layers and is used by the robot to plan safe paths. The configuration enables each layer and sets parameters like inflation radius. Understanding the order—static map, obstacles, inflation—is key to configuring costmaps correctly.

Practice

(1/5)
1. Which costmap layer in ROS is responsible for marking fixed obstacles from a pre-existing map?
easy
A. Obstacle layer
B. Inflation layer
C. Static layer
D. Sensor layer

Solution

  1. Step 1: Understand the role of the static layer

    The static layer uses a pre-built map to mark fixed obstacles that do not change over time.
  2. Step 2: Compare with other layers

    The obstacle layer updates obstacles dynamically from sensors, and the inflation layer adds safety buffers, so they do not mark fixed obstacles directly.
  3. Final Answer:

    Static layer -> Option C
  4. Quick Check:

    Fixed obstacles = Static layer [OK]
Hint: Static layer = fixed map obstacles [OK]
Common Mistakes:
  • Confusing obstacle layer with static layer
  • Thinking inflation layer marks obstacles
  • Assuming sensor data is static
2. Which of the following YAML snippets correctly enables the inflation layer in a ROS costmap configuration?
easy
A. inflation: enable: true radius: 0.5
B. inflation_layer: active: yes radius: 1.0
C. inflation_layer: enabled: false inflation_radius: 0.5
D. inflation_layer: enabled: true inflation_radius: 0.5

Solution

  1. Step 1: Check correct keys for inflation layer

    The correct keys are 'inflation_layer' with 'enabled' and 'inflation_radius' as parameters.
  2. Step 2: Validate values and syntax

    inflation_layer: enabled: true inflation_radius: 0.5 uses 'enabled: true' and 'inflation_radius: 0.5', which is correct YAML syntax and valid keys.
  3. Final Answer:

    inflation_layer: enabled: true inflation_radius: 0.5 -> Option D
  4. Quick Check:

    Correct keys and true enabled = inflation_layer: enabled: true inflation_radius: 0.5 [OK]
Hint: Look for 'enabled: true' and 'inflation_radius' keys [OK]
Common Mistakes:
  • Using wrong key names like 'enable' or 'active'
  • Setting enabled to false when enabling
  • Incorrect indentation or YAML syntax
3. Given this costmap configuration snippet:
obstacle_layer:
  observation_sources: laser_scan_sensor
  laser_scan_sensor:
    data_type: LaserScan
    topic: /scan
    marking: true
    clearing: true
inflation_layer:
  inflation_radius: 0.7
  cost_scaling_factor: 10.0

What effect does setting marking: true and clearing: true have on the obstacle layer?
medium
A. It marks obstacles detected by the laser and clears free space around them
B. It disables obstacle detection and only inflates existing obstacles
C. It marks obstacles but does not clear any free space
D. It clears obstacles but does not mark new ones

Solution

  1. Step 1: Understand marking and clearing flags

    Setting 'marking: true' means detected obstacles are added to the costmap. 'clearing: true' means free space detected is cleared from the costmap.
  2. Step 2: Apply to laser_scan_sensor

    The laser scan sensor will mark obstacles and clear free space dynamically based on sensor data.
  3. Final Answer:

    It marks obstacles detected by the laser and clears free space around them -> Option A
  4. Quick Check:

    marking + clearing true = mark and clear obstacles [OK]
Hint: marking=true adds obstacles, clearing=true removes free space [OK]
Common Mistakes:
  • Assuming clearing disables marking
  • Thinking marking disables clearing
  • Confusing cost_scaling_factor with marking
4. You have this partial costmap config:
inflation_layer:
  inflation_radius: 0.6
  cost_scaling_factor: -5.0

What is the problem with this configuration?
medium
A. inflation_radius must be an integer, not a float
B. Negative cost_scaling_factor is invalid and causes inflation errors
C. Missing 'enabled: true' disables inflation layer
D. cost_scaling_factor should be zero to disable inflation

Solution

  1. Step 1: Check cost_scaling_factor value

    The cost_scaling_factor controls how quickly costs drop off from obstacles. It must be positive; negative values are invalid.
  2. Step 2: Understand impact of negative value

    A negative cost_scaling_factor causes errors or unexpected inflation behavior in the costmap.
  3. Final Answer:

    Negative cost_scaling_factor is invalid and causes inflation errors -> Option B
  4. Quick Check:

    cost_scaling_factor < 0 = error [OK]
Hint: cost_scaling_factor must be positive [OK]
Common Mistakes:
  • Thinking inflation_radius must be integer
  • Assuming missing enabled disables inflation
  • Believing zero cost_scaling_factor disables inflation
5. You want to configure a ROS costmap that uses a static map, detects obstacles with a laser scanner, and inflates obstacles with a radius of 0.8 meters. Which of the following combined configurations is correct?
hard
A. static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: true clearing: true inflation_layer: enabled: true inflation_radius: 0.8 cost_scaling_factor: 5.0
B. static_layer: enabled: false obstacle_layer: observation_sources: laser laser: data_type: PointCloud topic: /scan marking: false clearing: true inflation_layer: inflation_radius: 0.8 cost_scaling_factor: -1.0
C. static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: false clearing: false inflation_layer: enabled: true inflation_radius: 1.0 cost_scaling_factor: 10.0
D. static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: true clearing: false inflation_layer: enabled: true inflation_radius: 0.5 cost_scaling_factor: 5.0

Solution

  1. Step 1: Verify static layer configuration

    static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: true clearing: true inflation_layer: enabled: true inflation_radius: 0.8 cost_scaling_factor: 5.0 correctly sets 'static_layer' with 'map_topic: /map' to use the static map.
  2. Step 2: Check obstacle layer settings

    static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: true clearing: true inflation_layer: enabled: true inflation_radius: 0.8 cost_scaling_factor: 5.0 uses 'laser_scan' with correct data_type, topic, and both marking and clearing enabled for proper obstacle detection.
  3. Step 3: Confirm inflation layer parameters

    static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: true clearing: true inflation_layer: enabled: true inflation_radius: 0.8 cost_scaling_factor: 5.0 enables inflation with radius 0.8 and a positive cost_scaling_factor, matching requirements.
  4. Final Answer:

    static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: true clearing: true inflation_layer: enabled: true inflation_radius: 0.8 cost_scaling_factor: 5.0 -> Option A
  5. Quick Check:

    All layers correct and enabled = static_layer: map_topic: /map obstacle_layer: observation_sources: laser_scan laser_scan: data_type: LaserScan topic: /scan marking: true clearing: true inflation_layer: enabled: true inflation_radius: 0.8 cost_scaling_factor: 5.0 [OK]
Hint: Check all layers enabled with correct parameters [OK]
Common Mistakes:
  • Disabling static layer or obstacle marking
  • Using negative cost_scaling_factor
  • Setting inflation_radius different from 0.8
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard