Skip to main content

ros2-launch

Write and debug ROS 2 Python launch files — substitutions, OpaqueFunction, composable containers, lifecycle events, namespaces. Use when editing launch.py, IncludeLaunchDescription, LaunchConfiguration, or bringup.

소스 정보

저장소
guilyx/dotfiles
최근 소스 활동
2026년 8월 12일 19:39
감지된 SKILL.md 언어
영어
스타
0
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
ros2-launch
description
Write and debug ROS 2 Python launch files — substitutions, OpaqueFunction, composable containers, lifecycle events, namespaces. Use when editing launch.py, IncludeLaunchDescription, LaunchConfiguration, or bringup.
# ROS 2 Python Launch ## Substitutions vs Python values `LaunchConfiguration('foo')` is **not** a `str` at declaration time. You cannot `if LaunchConfiguration('sim') == 'true'` in plain Python. Use: - `IfCondition` / `UnlessCondition` / `PythonExpression` - `OpaqueFunction` when you need real Python after substitutions resolve ```python def launch_setup(context, *args, **kwargs): sim = LaunchConfiguration('sim').perform(context) == 'true' # now branch, load YAML, compute remaps return [nodes...] # in generate_launch_description: OpaqueFunction(function=launch_setup) ``` ## Composition vs processes | Action | Process | |--------|---------| | `Node(...)` | New process | | `ComposableNode` in `ComposableNodeContainer` | Same process (intra-process possible) | | `LoadComposableNode` | Load into an existing container | Do not wrap a composable plugin with `Node(executable=...)` unless there is a standalone main. ## Namespaces and remaps - `PushRosNamespace` / `GroupAction` for multi-robot (`/uav1/imu`). - Remaps are **unresolved names** relative to the node's namespace unless absolute (`/tf`). - `/tf` and `/tf_static` are usually **global** — remap carefully or you split the tree. ## Timing anti-patterns - `TimerAction(period=3.0)` to wait for a driver is a race. Prefer lifecycle events or a lifecycle manager. - `RegisterEventHandler(OnProcessExit(...))` for shutdown chains; `OnStateTransition` for managed nodes (`ros2-lifecycle`). ## Parameters in launch ```python parameters=[config.yaml, {'use_sim_time': sim, 'foo': 1}] ``` Later dicts override earlier YAML keys for that node. Wildcard YAML (`/**:`) is easy to apply to the wrong node — see `ros2-parameters`. ## Debug ```bash ros2 launch pkg file.launch.py --show-args ros2 launch pkg file.launch.py --debug ``` Print the resolved `Node` kwargs from `OpaqueFunction` when remaps look wrong.
GitHub에서 보기