360 Secure SkillHub
360 安全技能中心

ROS2 Control Execution

该 Skill 用于修改 ros2_control 图,支持加载、配置、启动、停止、切换、卸载控制器以及设置硬件组件状态。所有操作须经本地包装脚本执行,该脚本以 subprocess(shell=False)方式调用并按严格允许列表校验子命令,可通过参数配置名称或参数文件传入复杂 ros-args。使用前需先 source ROS 2 环境与工作空间。

bigrobinson
bigrobinson
热度 39.58
最近更新 2026-05-11 17:41:04
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ros2-control-execution
Metadata
name
ros2-control-execution
description
Execute ROS 2 Control state-changing commands (load, switch, unload) in a sandboxed environment. Supports parameter profiles.

ROS 2 Control Execution (Sandboxed)

Setup & Installation

Before this skill can be used, the local environment must be configured.

  1. Source your environment: You MUST source your ROS 2 environment first.
    source /opt/ros/<distro>/setup.bash
    source ~/my_ros_ws/install/setup.bash
    
  2. Run setup:
    ./scripts/setup.sh
    

Overview

Use this skill to modify the ros2_control graph. You can use it to load, configure, start, stop, and switch controllers.

SECURITY CONSTRAINT: You must ALWAYS use the safe wrapper script located at ./scripts/safe_ros2_control_execution.py. This script uses Python's subprocess (shell=False) to prevent command injection and validates the command against a strict allowlist.

Wrapper Path: Resolve ./scripts/safe_ros2_control_execution.py against this SKILL.md directory.

Allowed Commands

Usage: ./scripts/safe_ros2_control_execution.py <subcommand> [native_flags] [--profile <name> | --params-file <path>]

  • load_controller
  • reload_controller_libraries
  • set_controller_state
  • set_hardware_component_state
  • switch_controllers
  • unload_controller
  • cleanup_controller

Examples:

  • Load a controller: ./scripts/safe_ros2_control_execution.py load_controller joint_trajectory_controller -c /controller_manager
  • Set controller state (e.g., to active): ./scripts/safe_ros2_control_execution.py set_controller_state joint_trajectory_controller active -c /controller_manager
  • Switch controllers: ./scripts/safe_ros2_control_execution.py switch_controllers --activate joint_trajectory_controller --deactivate position_controller -c /controller_manager
  • Using a parameter profile (for complex --ros-args): ./scripts/safe_ros2_control_execution.py load_controller my_ctrl -c /my_manager --profile outdoor_tuning