运行模拟演示¶
用默认的 hardware:=mock_components 插件运行演示(Acone xacro 上为 mock_components/GenericSystem)。不需要 Gazebo / Isaac / 真机。
前提条件¶
已完成 安装环境
已用
./init_repo.sh初始化工作区并完成colcon build精简分支(
arx-lift2s、panthera-ht):./quick_start.sh(构建成功后会 sourceinstall/)。在open-deploy-ws的main上,colcon build之后在启动终端source install/setup.bash(标准 ROS overlay;没有额外环境脚本)。
步骤¶
1. Source Workspace¶
构建成功后,从工作区根目录:
source install/setup.bash
2. Launch Mock Demo¶
demo.launch.py 默认 robot:=cr5 和 hardware:=mock_components。可省略或显式传入。没有 hardware:=mock。
ros2 launch ocs2_arm_controller demo.launch.py
3. Observe¶
RViz(
demo_ocs2.rviz)当
enable_arms_target_manager为true(默认)时启动arms_target_managerFSM 从 HOLD 开始 —
/fsm_command为std_msgs/Int32(1HOME、2HOLD、3OCS2)
不要发布 /target_pose。那不是全栈通用 API。见 FSM 与话题 和 本技术栈中的 ros2_control。
使用不同机器人¶
# Acone (dual-arm, not Lift 2S)
ros2 launch ocs2_arm_controller demo.launch.py robot:=arx_acone
# HighTorque Panthera HT
ros2 launch ocs2_arm_controller demo.launch.py robot:=panthera_ht
Taku¶
Taku 在 robot_descriptions 的 feature/agilex 上(humanoid/Dyna/taku_description)。启动前先看 Taku / feature/agilex。控制用 split_body.launch.py / full_body.launch.py,不是 demo.launch.py。
colcon build --packages-up-to ocs2_arm_controller taku_description
source install/setup.bash
ros2 launch ocs2_arm_controller split_body.launch.py robot:=taku
公开 mock 是 split_body.launch.py:ocs2_arm_controller(双臂 MPC)加上 body_joint_controller / head_joint_controller,以及通过 adaptive_gripper_controller 控制的 Dynaclaw(*_gripper_joint;URDF 里另一侧爪为 mimic)。没有底盘或单臂 basic 控制器。full_body.launch.py robot:=taku 需要私有 ocs2_wbc_controller 子模块;描述里有 config/ocs2/fixed_base_tcp.info 并不够。当该配置和私有模块都在时,全身默认 headMode 是 HEAD_GAZE(注视 head_camera_mid_optical_frame)。target_manager.yaml 里 enable_head_control: false。分体仍使用 head_joint_controller。
在 RViz 中把 Fixed Frame 设为 base_link(包根)或重合的 base_footprint。OCS2 的 baseFrame / marker 使用 base_link(config/ocs2/target_manager.yaml 中的 marker_fixed_frame)。
hardware:=gz(Gazebo)可能需要 GPU。默认验证路径用 mock + RViz;需要物理仿真时见 Gazebo 仿真。
末端执行器(type)¶
不是 gripper:=。此 launch 包含 create_robot_profile_launch_arguments()。对称末端:type:=。左右不同:同时传 left_type:= 与 right_type:=(此时不要再传 type:=)。除非 use_profile_eef:=false,否则使用 profile 的 defaults.end_effectors。见 切换机器人 与 robot_common_launch。
ros2 launch ocs2_arm_controller demo.launch.py \
robot:=<robot_name> \
use_profile_eef:=false \
left_type:=rg75 right_type:=linkerhand_o7
启动参数(来自 demo.launch.py + robot_common_launch)¶
参数 |
文档中的取值 |
此 launch 的默认值 |
|---|---|---|
|
|
|
|
描述包键( |
|
|
末端键,或把 |
profile 或 xacro |
|
|
|
|
|
|
|
|
|
demo.launch.py 没有声明 rviz:= 或 headless:=。只用上表中的参数。
验证¶
RViz 窗口打开并显示机器人模型
控制器进程在运行(HOLD)
/fsm_command被接受(std_msgs/Int32)
故障排除¶
机器人不运动¶
FSM 必须离开 HOLD(本控制器上 OCS2 用
/fsm_command3)查看控制器日志;不要假定存在
/target_pose发布者
RViz 中模型显示异常¶
重新编译描述软件包
描述包 README 中的
check_urdf/ 可视化 launchTaku: Fixed Frame 用
base_link(或base_footprint)
找不到命令¶
source install/setup.bash # Must source after building