new_nav2_plugin

Scaffolds Nav 2 plugins with pluginlib registration, lifecycle parameters, and integration tests.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/three1324/yeonjinautomotive --skill new-nav2-plugin-three1324
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new_nav2_plugin
Source: https://github.com/three1324/yeonjinautomotive/tree/main/.claude/skills/new_nav2_plugin
Command: npx skills add https://github.com/three1324/yeonjinautomotive --skill new-nav2-plugin-three1324

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing a new Nav 2 plugin requires wiring together pluginlib registration, lifecycle node parameter declaration, CMake exports, and YAML configuration, and missing any one step causes silent loader failures that are hard to debug. ## Core Features & Use Cases - Complete plugin scaffolding: Generates header, source, plugins.xml manifest, CMakeLists.txt, package.xml, and YAML config stubs for controllers, planners, behaviors, smoothers, goal checkers, progress checkers, costmap layers, and BT nodes. - Correctness guardrails: Enforces critical patterns like nav2_util::declare_parameter_if_not_declared, plugin-name-keyed parameters, and matching PLUGINLIB_EXPORT_CLASS base classes. - Integration testing: Includes a pluginlib ClassLoader-based gtest that verifies the plugin is constructible before deployment. - Use Case: You need a custom path-following controller for your robot. Use this Skill to generate a nav2_core::Controller subclass with all registration boilerplate, then verify it loads with the included test before pointing nav2_bringup at it. ## Quick Start Scaffold a new Nav 2 controller plugin called PurePursuitCustom in a package named my_nav2_controllers with a minimal load test.

Frequently Asked Questions about new_nav2_plugin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom Nav 2 controller plugin?

Subclass nav2_core::Controller, implement configure, activate, deactivate, computeVelocityCommands, setPlan, and setSpeedLimit, then export it with PLUGINLIB_EXPORT_CLASS. Register the class in a plugins.xml manifest and export it via pluginlib_export_plugin_description_file in CMakeLists.txt.

What base classes do Nav 2 plugin types use?

Controllers, planners, smoothers, goal checkers, progress checkers, and behaviors use nav2_core base classes. Costmap layers use nav2_costmap_2d::Layer, and behavior tree nodes use BT::SyncActionNode or BT::ConditionNode.

Why does my Nav 2 plugin fail to load at runtime?

The most common cause is a missing or mismatched PLUGINLIB_EXPORT_CLASS macro, where the base class argument does not match the loader's expected type. Also verify plugins.xml is installed and exported through pluginlib_export_plugin_description_file.

How do I declare parameters in a Nav 2 plugin?

Use nav2_util::declare_parameter_if_not_declared with keys prefixed by the plugin name, not the class name, because users configure parameters under the alias they choose in YAML. This also survives repeated configure calls across lifecycle transitions.

How do I test that a Nav 2 plugin loads correctly?

Write a gtest that instantiates pluginlib::ClassLoader with the appropriate base class and calls createSharedInstance with your fully qualified class name. A non-null result confirms the plugin is registered and constructible.

What are common mistakes when writing Nav 2 costmap layers?

Allocating memory inside updateCosts is a frequent mistake because it runs at costmap update rate and must stay hot-path-safe. Also ensure the plugin description file is exported against nav2_costmap_2d rather than nav2_core.