nav2_core_interfaces
This Claude Code skill provides the abstract base class interfaces for Nav2's core plugin system, including Controller (local planner), GlobalPlanner, Smoother, and GoalChecker. Use this when implementing custom navigation plugins for ROS2 Nav2, as all domain-specific plugins must inherit from these infrastructure-layer interfaces to integrate with the navigation stack.
git clone --depth 1 https://github.com/harunkurtdev/ros2-claude-code-template /tmp/nav2_core_interfaces && cp -r /tmp/nav2_core_interfaces/.claude/skills/nav2_core_interfaces ~/.claude/skills/nav2_core_interfacesSKILL.md
# Nav2 Core Plugin Interfaces
Source: `~/nav2_ws/src/navigation2/nav2_core/include/nav2_core/`
## Plugin Base Classes
All Nav2 plugins implement these abstract interfaces. Infrastructure layer implements them; domain/application layers depend on them.
### 1. Controller (Local Planner)
**Header:** `controller.hpp`
```cpp
class Controller {
public:
virtual void configure(
const rclcpp_lifecycle::LifecycleNode::WeakPtr &,
std::string name, std::shared_ptr<tf2_ros::Buffer>,
std::shared_ptr<nav2_costmap_2d::Costmap2DROS>) = 0;
virtual void cleanup() = 0;
virtual void activate() = 0;
virtual void deactivate() = 0;
virtual void newPathReceived() {};
virtual geometry_msgs::msg::TwistStamped computeVelocityCommands(
const geometry_msgs::msg::PoseStamped & pose,
const geometry_msgs::msg::Twist & velocity,
nav2_core::GoalChecker * goal_checker) = 0;
virtual void cancel() {};
virtual void setSpeedLimit(const double & speed_limit, const bool & percentage) = 0;
virtual void reset() {};
};
```
**Implementations:** DWB, MPPI, RegulatedPurePursuit, Graceful, RotationShim
### 2. GlobalPlanner
**Header:** `global_planner.hpp`
```cpp
class GlobalPlanner {
public:
virtual void configure(
const rclcpp_lifecycle::LifecycleNode::WeakPtr &,
std::string name, std::shared_ptr<tf2_ros::Buffer>,
std::shared_ptr<nav2_costmap_2d::Costmap2DROS>) = 0;
virtual void cleanup() = 0;
virtual void activate() = 0;
virtual void deactivate() = 0;
virtual nav_msgs::msg::Path createPlan(
const geometry_msgs::msg::PoseStamped & start,
const geometry_msgs::msg::PoseStamped & goal) = 0;
};
```
**Implementations:** NavFn, SmacPlanner2D, SmacPlannerHybrid, SmacPlannerLattice, ThetaStar
### 3. Smoother
**Header:** `smoother.hpp`
```cpp
class Smoother {
public:
virtual void configure(...) = 0;
virtual void cleanup() = 0;
virtual void activate() = 0;
virtual void deactivate() = 0;
virtual bool smooth(
nav_msgs::msg::Path & path,
const nav2_costmap_2d::Costmap2D & costmap) = 0;
};
```
**Implementations:** SimpleSmoother, SavitzkyGolaySmoother, ConstrainedSmoother
### 4. GoalChecker
**Header:** `goal_checker.hpp`
```cpp
class GoalChecker {
public:
virtual void initialize(...) = 0;
virtual void reset() = 0;
virtual bool isGoalReached(
const geometry_msgs::msg::Pose & query_pose,
const geometry_msgs::msg::Pose & goal_pose,
const geometry_msgs::msg::Twist & velocity) = 0;
virtual bool getTolerances(
geometry_msgs::msg::Pose & pose_tolerance,
geometry_msgs::msg::Twist & vel_tolerance) = 0;
};
```
### 5. ProgressChecker
**Header:** `progress_checker.hpp`
```cpp
class ProgressChecker {
public:
virtual void initialize(...) = 0;
virtual bool check(const geometry_msgs::msg::PoseStamped & current_pose) = 0;
virtual void reset() = 0;
};
```
### 6. PathHandler
**Header:** `path_handler.hpp`
```cpp
class PathHandler {
public:
virtual void initialize(...) = 0;
virtual void setPlan(const nav_msgs::msg::Path & path) = 0;
virtual nav_msgs::msg::Path findPlanSegment(...) = 0;
virtual nav_msgs::msg::Path transformLocalPlan(...) = 0;
virtual geometry_msgs::msg::PoseStamped getTransformedGoal(...) = 0;
};
```
### 7. Behavior
**Header:** `behavior.hpp`
```cpp
enum class CostmapInfoType { NONE, LOCAL, GLOBAL, BOTH };
class Behavior {
public:
virtual void configure(...) = 0;
virtual void cleanup() = 0;
virtual void activate() = 0;
virtual void deactivate() = 0;
virtual CostmapInfoType getResourceInfo() = 0;
};
```
**Implementations:** Spin, BackUp, DriveOnHeading, Wait, AssistedTeleop
### 8. WaypointTaskExecutor
**Header:** `waypoint_task_executor.hpp`
```cpp
class WaypointTaskExecutor {
public:
virtual void initialize(...) = 0;
virtual bool processAtWaypoint(
const geometry_msgs::msg::PoseStamped & current_pose,
const int & current_waypoint_index) = 0;
};
```
### 9. BehaviorTreeNavigator
**Header:** `behavior_tree_navigator.hpp`
Template class for BT-based navigation action plugins. Contains:
- `FeedbackUtils` struct (robot_frame, global_frame, transform_tolerance, tf)
- `NavigatorMuxer` (ensures single active navigator)
- `BehaviorTreeNavigator<ActionT>` (template with BT lifecycle)
## Exception Classes
### Controller Exceptions (`controller_exceptions.hpp`)
- `ControllerException`, `InvalidController`, `ControllerTFError`
- `FailedToMakeProgress`, `PatienceExceeded`, `InvalidPath`
- `NoValidControl`, `ControllerTimedOut`
### Planner Exceptions (`planner_exceptions.hpp`)
- `PlannerException`, `InvalidPlanner`, `StartOccupied`, `GoalOccupied`
- `StartOutsideMapBounds`, `GoalOutsideMapBounds`
- `NoValidPathCouldBeFound`, `PlannerTimedOut`, `PlannerTFError`
- `NoViapointsGiven`, `PlannerCancelled`
### Smoother Exceptions (`smoother_exceptions.hpp`)
- `SmootherException`, `InvalidSmoother`, `InvalidPath`
- `SmootherTimedOut`, `SmoothedPathInCollision`, `FailedToSmoothPath`
### Route Exceptions (`route_exceptions.hpp`)
- `RouteException`, `OperationFailed`, `NoValidRouteCouldBeFound`
- `TimedOut`, `RouteTFError`, `NoValidGraph`
- `IndeterminantNodesOnGraph`, `InvalidEdgeScorerUse`
## Creating a Custom Plugin
### Custom Controller Example (C++)
```cpp
#include "nav2_core/controller.hpp"
namespace my_controller {
class MyController : public nav2_core::Controller {
public:
void configure(
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
std::string name,
std::shared_ptr<tf2_ros::Buffer> tf,
std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) override
{
// Initialize from parameters
}
geometry_msgs::msg::TwistStamped computeVelocityCommands(
const geometry_msgs::msg::PoseStamped & pose,
const geometry_msgs::msg::Twist & velocity,
nav2_core::GoalChecker * goal_checker) override
{
// Compute and return velocity command
}
void setSpeedLimit(const double & speed_limit, const bool & percentage) override {}
voiScaffold a Behavior Tree leaf node — plain BehaviorTree.CPP (SyncActionNode / StatefulActionNode / ConditionNode) or a BehaviorTree.ROS2 wrapper (RosActionNode / RosServiceNode / RosTopicPubNode / RosTopicSubNode) — with ports, factory/plugin registration, and XML v4 usage. Trigger when the user asks to write a behavior-tree node (not Nav 2-specific).
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.
Build the colcon workspace (optionally a single package) and report the outcome.
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.
Author a new skill under .claude/skills/<name>/SKILL.md with valid frontmatter, following the template conventions, and index it in CLAUDE.md + README.md.
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.
Author a new asset for this .claude/ template — a rule, skill, slash command, or sub-agent — following the project's conventions and wiring it into the CLAUDE.md / README.md indexes. Trigger when the user wants to add or extend a command, skill, agent, or rule (make the template itself extensible).
Configure and build gz-sim from source using either CMake/Ninja directly or a colcon workspace. Trigger when the user asks to build, recompile, configure, or set up the gz-sim binary tree.