# PKG - navigation

### 2D navigation stack

input = odometry, sensor(avoid obstacles), and a goal pose

output = safe velocity commands

![](/files/-Lq83ZK7BUwFgcMxFzPx)

tf = determine the robot's location in the world and relate sensor data to a static map. (**no velocity data**)

odometry = publish both a transform and a nav\_msgs/Odometry message that ***contains velocity*** information.

### HW Requirements

1. for both differential drive and holonomic wheeled robots only. command = Vel\_x, Vel\_y, Vel\_theta.
2. planar laser mounted, for map building and localization.

### costmaps

This uses 2 costmaps to store information about obstacles in the world, and in total 3 maps

global = long-term plans

local = local planning and obstacle avoidance

common = global & local

<http://wiki.ros.org/costmap_2d>

## costmap\_common\_params.yaml

```yaml
# obstacle information
obstacle_range: 2.5
raytrace_range: 3.0

# robot body
footprint: [[x0, y0], [x1, y1], ... [xn, yn]]
#robot_radius: ir_of_robot
inflation_radius: 0.55

# source
observation_sources: laser_scan_sensor point_cloud_sensor
laser_scan_sensor: {sensor_frame: frame_name, data_type: LaserScan, topic: topic_name, marking: true, clearing: true}
point_cloud_sensor: {sensor_frame: frame_name, data_type: PointCloud, topic: topic_name, marking: true, clearing: true}
```

#### obstacle\_range: 2.5

The robot will only update its map with info about obstacles that are within 2.5 meters of the base.

#### raytrace\_range: 3.0

The robot will attempt to clear out space in front of it up to 3.0 meters away given a sensor reading.

#### footprint: \[\[x0, y0], \[x1, y1], ... \[xn, yn]]

center of the robot is assumed to be at (0.0, 0.0)

#### inflation\_radius: 0.55

the robot will treat all paths that stay 0.55 meters or more away from obstacles as having equal obstacle cost.

### global\_costmap\_params.yaml

```yaml
global_costmap:
  global_frame: /map
  robot_base_frame: base_link
  update_frequency: 5.0
  static_map: true
```

#### global\_frame

defines what coordinate frame the costmap should run in

#### robot\_base\_frame

defines the coordinate frame the costmap should reference for the base of the robot.

#### static\_map

If you aren't using an existing map or map server, set the static\_map parameter to false.

### local\_costmap\_params.yaml

```yaml
local_costmap:
  global_frame: odom
  robot_base_frame: base_link
  update_frequency: 5.0
  publish_frequency: 2.0
  static_map: false
  rolling_window: true
  width: 6.0
  height: 6.0
  resolution: 0.05
```

#### rolling\_window

true means that the costmap will remain centered around the robot as the robot moves through the world.

#### width (meters), height (meters), and resolution (meters/cell)

dimension of the costmap

### base\_local\_planner

given a high-level plan, compute velocity commands and send to the robot.

```yaml
TrajectoryPlannerROS:
  max_vel_x: 0.45
  min_vel_x: 0.1
  max_vel_theta: 1.0
  min_in_place_vel_theta: 0.4

  acc_lim_theta: 3.2
  acc_lim_x: 2.5
  acc_lim_y: 2.5
  holonomic_robot: true
```

<http://wiki.ros.org/base_local_planner>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://huang-jason.gitbook.io/ros/pkg-navigation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
