一键导入
ros2-launch-configuration
Clean Architecture compatible ROS2 launch files and parameter management (Python)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Clean Architecture compatible ROS2 launch files and parameter management (Python)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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).
Bootstrap a complete ROS 2 colcon workspace from scratch — directory layout, .gitignore, top-level README, this .claude/ config, an interfaces package and a first Clean Architecture package, and a bringup package. Trigger when the user asks to create a new workspace / start a new ROS 2 project from zero.
Scaffold 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).
Scaffold a ros2_control hardware component (SystemInterface / ActuatorInterface / SensorInterface) and its bringup — the plugin (on_init/on_configure/on_activate, RT-safe read()/write()), URDF <ros2_control> wiring, controllers.yaml + launch, pluginlib export. Trigger when the user asks to integrate hardware or bring up a robot under ros2_control.
Scaffold or extend a ros2_control controller or broadcaster (ControllerInterface / ChainableControllerInterface) — base-class choice, command/state interface configuration, lifecycle, real-time-safe update(), generate_parameter_library, pluginlib export, tests. Trigger when the user asks to write a ros2_control controller or broadcaster.
Bridge a VDA 5050 v3.0.0 fleet-control interface (MQTT/JSON) onto Nav 2 under Clean Architecture — domain entities, MQTT/Nav 2 adapters behind ports, order→NavigateThroughPoses mapping, state aggregation, action handlers. Trigger when the user asks to build or extend a VDA 5050 connector / fleet bridge.
| name | ROS2 Launch & Configuration |
| description | Clean Architecture compatible ROS2 launch files and parameter management (Python) |
This skill provides a guide for creating modular and reusable ROS2 launch files, which are written in Python for both C++ and Python nodes.
packages/
└── robot_core/
└── launch/
├── robot_launch.py # Main launch file
├── sensors_launch.py # Sensor subsystem
├── navigation_launch.py # Navigation subsystem
└── includes/
├── common.py # Common functions
└── defaults.py # Default values
#!/usr/bin/env python3
"""
Launch file: robot_launch.py
Description: Main robot system launch file
"""
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import (
DeclareLaunchArgument,
IncludeLaunchDescription,
GroupAction,
SetEnvironmentVariable,
LogInfo
)
from launch.conditions import IfCondition, UnlessCondition
from launch.substitutions import (
LaunchConfiguration,
PathJoinSubstitution
)
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node, SetParameter
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
"""Generate launch description."""
# Package paths
pkg_robot_core = get_package_share_directory('robot_core')
# Launch arguments
declared_arguments = [
DeclareLaunchArgument(
'robot_name',
default_value='robot_1',
description='Robot namespace'
),
DeclareLaunchArgument(
'use_sim',
default_value='false',
description='Use simulation mode'
),
DeclareLaunchArgument(
'config_file',
default_value=os.path.join(pkg_robot_core, 'config', 'params.yaml'),
description='Path to parameter file'
),
]
# Configurations
robot_name = LaunchConfiguration('robot_name')
use_sim = LaunchConfiguration('use_sim')
config_file = LaunchConfiguration('config_file')
# Environment setup
env_setup = [
SetEnvironmentVariable('RCUTILS_COLORIZED_OUTPUT', '1'),
]
# Global parameters
global_params = SetParameter(name='use_sim_time', value=use_sim)
# C++ Node Example
cpp_node = Node(
package='robot_cpp_pkg',
executable='robot_controller_cpp', # Name of the C++ executable in CMakeLists.txt
name='controller',
namespace=robot_name,
parameters=[config_file],
output='screen'
)
# Python Node Example
py_node = Node(
package='robot_py_pkg',
executable='sensor_node.py', # Name of the script or entry point
name='sensors',
namespace=robot_name,
parameters=[config_file],
output='screen',
condition=UnlessCondition(use_sim)
)
return LaunchDescription(
declared_arguments +
env_setup +
[global_params, cpp_node, py_node]
)
# config/params.yaml
/**:
ros__parameters:
# Global parameters
use_sim_time: false
log_level: "info"
robot_state:
ros__parameters:
# Robot state node parameters
update_rate: 100.0
frame_id: "base_link"
# Nested parameters
position_filter:
type: "kalman"
process_noise: 0.01
navigation:
ros__parameters:
max_velocity: 1.5
planner:
type: "astar"
// Within a ROS2 Node
void load_parameters() {
this->declare_parameter("update_rate", 10.0);
this->declare_parameter("position_filter.type", "default");
double rate = this->get_parameter("update_rate").as_double();
std::string filter_type = this->get_parameter("position_filter.type").as_string();
RCLCPP_INFO(this->get_logger(), "Rate: %f, Filter: %s", rate, filter_type.c_str());
}
from launch_ros.actions import LifecycleNode
from launch_ros.events.lifecycle import ChangeState
from lifecycle_msgs.msg import Transition
from launch.actions import EmitEvent, RegisterEventHandler
from launch.event_handlers import OnProcessStart
def generate_launch_description():
# ...
driver_node = LifecycleNode(
package='robot_drivers',
executable='lidar_driver',
name='lidar',
namespace='',
output='screen'
)
# Auto-configure on start
configure_event = RegisterEventHandler(
OnProcessStart(
target_action=driver_node,
on_start=[
EmitEvent(event=ChangeState(
lifecycle_node_matcher=lambda n: n == driver_node,
transition_id=Transition.TRANSITION_CONFIGURE,
)),
]
)
)
return LaunchDescription([driver_node, configure_event])