Skip to main content
ClaudeWave
Skill210 repo starsupdated 1mo ago

nav2_servers

This Claude Code skill provides configuration and orchestration for three critical Nav2 server components: the Lifecycle Manager coordinates state transitions across all Nav2 nodes using bond connections for health monitoring, the Velocity Smoother applies acceleration and deceleration limits to raw velocity commands for smooth robot motion, and the Collision Monitor performs real-time safety filtering by intercepting velocity commands and applying defensive actions when obstacles are detected. Use this when setting up a complete Nav2 navigation stack requiring coordinated node lifecycle management, kinematic-limited motion control, and collision avoidance.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/harunkurtdev/ros2-claude-code-template /tmp/nav2_servers && cp -r /tmp/nav2_servers/.claude/skills/nav2_servers ~/.claude/skills/nav2_servers
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Nav2 Server Nodes

Source: `~/nav2_ws/src/navigation2/`

## Lifecycle Manager

**Package:** `nav2_lifecycle_manager`
**Purpose:** Orchestrate lifecycle transitions of all Nav2 nodes

### Architecture
Manages state machine: `UNCONFIGURED → INACTIVE → ACTIVE → FINALIZED`
Uses bond connections for health monitoring. Auto-reconnects on failure.

### Key Parameters
```yaml
lifecycle_manager:
  ros__parameters:
    autostart: true
    bond_timeout: 4.0
    bond_heartbeat_period: 0.5
    service_timeout: 5.0
    attempt_respawn_reconnection: true
    node_names:
      - "map_server"
      - "amcl"
      - "controller_server"
      - "planner_server"
      - "smoother_server"
      - "behavior_server"
      - "bt_navigator"
      - "waypoint_follower"
      - "velocity_smoother"
      - "collision_monitor"
```

### Service
- `manage_nodes` (nav2_msgs/ManageLifecycleNodes)
  - Commands: STARTUP(0), PAUSE(1), RESUME(2), RESET(3), SHUTDOWN(4), CONFIGURE(5), CLEANUP(6)

---

## Velocity Smoother

**Package:** `nav2_velocity_smoother`
**Purpose:** Apply acceleration/deceleration limits to velocity commands

### Architecture
- Subscribes to raw `cmd_vel` (from controller)
- Publishes smoothed `cmd_vel_smoothed`
- Enforces kinematic limits on linear and angular velocities

### Key Parameters
```yaml
velocity_smoother:
  ros__parameters:
    smoothing_frequency: 20.0
    scale_velocities: false
    feedback: "OPEN_LOOP"           # or "CLOSED_LOOP" (uses odom)
    max_velocity: [0.26, 0.0, 1.0]   # [vx, vy, wz]
    min_velocity: [-0.26, 0.0, -1.0]
    max_accel: [2.5, 0.0, 3.2]
    max_decel: [-2.5, 0.0, -3.2]
    deadband_velocity: [0.0, 0.0, 0.0]
    velocity_timeout: 1.0
    odom_topic: "odom"
    odom_duration: 0.1
```

---

## Collision Monitor

**Package:** `nav2_collision_monitor`
**Purpose:** Real-time collision avoidance between controller and hardware

### Architecture
Intercepts `cmd_vel` → applies safety actions → outputs safe `cmd_vel`.
Monitors configurable polygons/circles around robot.

**Action Types:**
| Type | Behavior |
|------|----------|
| `stop` | Zero velocity on detection |
| `slowdown` | Reduce velocity by factor |
| `limit` | Cap max velocity |
| `approach` | Slow proportionally to distance |

**Polygon Sources:**
- `Polygon` - Static polygon shape
- `Circle` - Circular zone
- `VelocityPolygon` - Dynamic polygon based on current velocity

**Data Sources:**
- `Scan` - LaserScan
- `PointCloud` - PointCloud2
- `Range` - Single range sensor
- `Costmap` - Costmap data

### Key Parameters
```yaml
collision_monitor:
  ros__parameters:
    cmd_vel_in_topic: "cmd_vel_smoothed"
    cmd_vel_out_topic: "cmd_vel"
    transform_tolerance: 0.5
    source_timeout: 5.0
    stop_pub_timeout: 2.0
    polygons: ["FootprintApproach"]
    FootprintApproach:
      type: "polygon"
      action_type: "approach"
      footprint_topic: "/local_costmap/published_footprint"
      time_before_collision: 2.0
      simulation_time_step: 0.02
      max_points: 5
      enabled: true
    observation_sources: ["scan"]
    scan:
      type: "scan"
      topic: "/scan"
```

### Collision Detector
Separate node (`CollisionDetector`) that only detects, doesn't modify commands. Publishes `CollisionDetectorState`.

---

## Smoother Server

**Package:** `nav2_smoother`
**Action:** `SmoothPath`
**Purpose:** Host path smoother plugins

### Smoother Plugins
| Plugin | Package | Algorithm |
|--------|---------|-----------|
| `SimpleSmoother` | `nav2_smoother` | Basic iterative smoothing |
| `SavitzkyGolaySmoother` | `nav2_smoother` | Savitzky-Golay filter |
| `ConstrainedSmoother` | `nav2_constrained_smoother` | Convex optimization with constraints |

```yaml
smoother_server:
  ros__parameters:
    smoother_plugins: ["simple_smoother"]
    simple_smoother:
      plugin: "nav2_smoother::SimpleSmoother"
      tolerance: 1.0e-10
      max_its: 1000
      do_refinement: true
```

### Constrained Smoother
```yaml
    constrained_smoother:
      plugin: "nav2_constrained_smoother::ConstrainedSmoother"
      tolerance: 1.0e-10
      max_its: 1000
      enforce_path_inversion: true  # For lattice planner
      do_refinement: true
      w_smooth: 0.3
      w_data: 0.2
```

---

## Waypoint Follower

**Package:** `nav2_waypoint_follower`
**Actions:** `FollowWaypoints`, `FollowGPSWaypoints`
**Purpose:** Sequential navigation through ordered waypoints

### Architecture
Uses `NavigateToPose` action internally for each waypoint. Supports plugin-based task execution at each waypoint.

### Key Parameters
```yaml
waypoint_follower:
  ros__parameters:
    loop_rate: 20
    stop_on_failure: true
    waypoint_task_executor_plugin: "wait_at_waypoint"
    wait_at_waypoint:
      plugin: "nav2_waypoint_follower::WaitAtWaypoint"
      enabled: true
      waypoint_pause_duration: 200  # ms
```

---

## Docking Server

**Package:** `nav2_docking`
**Actions:** `DockRobot`, `UndockRobot`
**Purpose:** Autonomous charging dock approach/departure

### Architecture
- Navigates to staging pose → detects dock → controlled approach → verify charging
- Plugin-based dock types (SimpleChargingDock, SimpleNonChargingDock)
- Internal controller for precise dock approach
- Pose filtering for dock detection smoothing

### Key Parameters
```yaml
docking_server:
  ros__parameters:
    dock_plugins: ["simple_charging_dock"]
    simple_charging_dock:
      plugin: "opennav_docking::SimpleChargingDock"
      docking_threshold: 0.05
      staging_x_offset: -0.7
      use_external_detection_pose: true
    docks: ["home_dock"]
    home_dock:
      type: "simple_charging_dock"
      frame: "map"
      dock_pose: [0.0, 0.0, 0.0]
    controller:
      use_collision_detection: true
      k_phi: 3.0
      k_delta: 2.0
      v_linear_min: 0.15
      v_linear_max: 0.25
    filter_coef: 0.1
    detection_timeout: 10.0
    max_retries: 3
```

---

## Following Server

**Package:** `nav2_following`
**Action:** `FollowObject`
**Purpose:** Track and follow dynamic targets

### Arch
behaviortree-reviewerSubagent

Use proactively before opening a PR that adds or changes BehaviorTree.CPP nodes or BehaviorTree.ROS2 wrappers (RosActionNode/RosServiceNode/RosTopicPub/SubNode, TreeExecutionServer). Reviews a diff against BT.CPP v4 conventions — node base-class choice, non-blocking ticks, ports/blackboard typing, factory/plugin registration, XML v4, and the ROS 2 wrapper contract. Returns a punch list with file:line anchors, not a rewrite.

clean-arch-architectSubagent

Use when a design decision touches Clean Architecture boundaries in a ROS 2 project — which layer a new behaviour belongs to, whether a port belongs in domain or application, whether a new node should be lifecycle-managed, whether to compose nodes or split packages. Returns an architectural recommendation with trade-offs, not implementation.

ecs-architectSubagent

Use when a design decision touches the gz-sim ECS — where new state should live, which system phase should write it, how to avoid coupling, whether to add a component vs. a member variable, whether a new system should be split or merged with an existing one. Returns an architectural recommendation with trade-offs, not implementation.

gz-style-reviewerSubagent

Use proactively before opening any gz-sim PR. Reviews a diff against the project's C++17 style, ECS conventions, plugin registration patterns, CMake structure, test placement, Migration.md / Changelog.md expectations, and pre-commit configuration. Returns a punch list, not a rewrite.

ros2-controllers-reviewerSubagent

Use proactively before opening a PR that adds or changes a ros2_control controller, broadcaster, or hardware component (incl. URDF <ros2_control> bringup). Reviews a diff against ros2_controllers / ros2_control_demos conventions — controller & hardware lifecycle, command/state interface configuration, real-time safety of update()/read()/write(), generate_parameter_library usage, pluginlib registration, chainable-controller correctness, URDF wiring, and tests. Returns a punch list with file:line anchors, not a rewrite.

ros2-style-reviewerSubagent

Use proactively before opening any ROS 2 / Nav 2 PR. Reviews a diff against this template's Clean Architecture, ROS 2 communication, lifecycle, testing, and Nav 2 plugin conventions. Returns a punch list with file:line anchors, not a rewrite.

vda5050-reviewerSubagent

Use proactively before opening a PR that touches a VDA 5050 connector / fleet bridge. Reviews a diff against VDA 5050 v3.0.0 protocol compliance (topics, QoS, header rules, base/horizon, action state machine, schema validation) and the template's Clean Architecture for the MQTT↔Nav 2 bridge. Returns a punch list with file:line anchors, not a rewrite.

buildSlash Command

Build the colcon workspace (optionally a single package) and report the outcome.