Arm Control is a ROS 2 workspace for a custom 3-DOF robotic arm. It combines MoveIt 2 planning, ros2_control hardware interfaces, task-level service nodes, suction-tool integration, and simulation/demo launch files.
The repository is intended for robotics developers who want to run the arm in either fake-control simulation or on the mixed real-hardware stack used by the project.
- MoveIt 2 configuration for the
arm-new233-axis arm, including URDF/Xacro, SRDF, joint limits, kinematics, controllers, RViz configuration, and mesh assets. - ros2_control hardware support for CubeMars AK80, Unitree Go-M8010-6, and DJI 2006 motors.
- Portfolio/demo launch flow with fake ros2_control execution, MoveIt, RViz, task services, and mock suction services.
- Real-hardware launch flow that wires joint 1 to CubeMars AK80 over SocketCAN, joint 2 to Unitree Go-M8010-6 over serial, and joint 3 to DJI 2006 over SocketCAN.
- Task-level Python services for named-pose execution, block storage flow, suction control, startup raise, gravity compensation, trajectory monitoring, and workspace/debug tooling.
| Path | Purpose |
|---|---|
src/arm-new23 |
Base robot description package with URDF, meshes, RViz config, and display launch files. |
src/arm_moveit_config_grand_new23 |
Main MoveIt 2 package, controller config, launch files, custom services, and task orchestration scripts. |
src/cubemars_hardware |
ros2_control SystemInterface for CubeMars AK-series motors over SocketCAN; this arm is tested with AK80. |
src/unitree_hardware |
ros2_control SystemInterface for Unitree motors over serial; this arm is tested with Go-M8010-6. |
src/dji_hardware |
DJI ros2_control hardware interface and standalone SocketCAN test executable; this arm is tested with DJI 2006. |
src/new_dj_sdk/src/m3508_ros2_sdk |
Standalone ROS 2 SocketCAN driver with historical M3508/C620 naming; this workspace uses it with DJI 2006. |
src/unitree_actuator_sdk |
Packaged Unitree actuator SDK library and headers. |
The main workspace targets Ubuntu 22.04 with ROS 2 Humble. Other ROS 2 distributions may work, but package names, MoveIt behavior, and controller APIs may require small adjustments.
Tested hardware setup:
- Joint 1: CubeMars AK80 over SocketCAN.
- Joint 2: Unitree Go-M8010-6 over serial.
- Joint 3: DJI 2006 over SocketCAN.
Recommended system dependencies:
sudo apt update
sudo apt install -y \
python3-colcon-common-extensions \
python3-rosdep \
python3-serial \
can-utils \
ros-humble-desktop \
ros-humble-moveit \
ros-humble-ros2-control \
ros-humble-ros2-controllers \
ros-humble-xacro \
ros-humble-rviz2 \
ros-humble-warehouse-ros-mongoInitialize rosdep once per machine if needed:
sudo rosdep init
rosdep updateFrom the workspace root:
source /opt/ros/humble/setup.bash
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source install/setup.bashFor a faster documentation/demo build, you can build only the robot description and MoveIt package:
colcon build --symlink-install --packages-select arm-new23 arm_moveit_config_grand_new23
source install/setup.bashUse this path first if you do not have hardware attached. It starts MoveIt, RViz, fake ros2_control execution, task services, and mock suction services.
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch arm_moveit_config_grand_new23 portfolio_sim.launch.pyHeadless mode:
ros2 launch arm_moveit_config_grand_new23 portfolio_sim.launch.py use_rviz:=falseUseful service calls:
ros2 service call /move_to_position_direct \
arm_moveit_config_grand_new23/srv/MoveToPosition \
"{pose_id: 2, pose_flag: true}"
ros2 service call /execute_named_sequence \
arm_moveit_config_grand_new23/srv/ExecuteNamedSequence \
"{pose_names: ['startup_raise', 'pose_to_grand'], durations: [2.0, 3.0]}"
ros2 service call /set_block_storage_state \
arm_moveit_config_grand_new23/srv/SetBlockStorageState \
"{state: 0}"Hardware motion can be dangerous. Keep the robot supported, clear the workspace, verify emergency stop behavior, and start with conservative torque/current limits before running any command that moves motors.
For a native SocketCAN interface:
sudo ip link set can0 down || true
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up
candump can0For CANable/CANable2 in SLCAN mode, replace /dev/ttyACM0 with your device path:
bash src/new_dj_sdk/src/m3508_ros2_sdk/scripts/setup_canable2_slcan.sh /dev/ttyACM0 can0
ip link show can0The full launch connects MoveIt, ros2_control, hardware interfaces, the task services, the serial suction bridge, and optional gravity compensation.
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch arm_moveit_config_grand_new23 demo.launch.py \
use_rviz:=true \
cubemars_joint1_can_interface:=can0 \
unitree_device:=/dev/ttyarm \
dji_device:=can0 \
tool_serial_port:=/dev/ttyserialCommon hardware parameters:
| Parameter | Default | Meaning |
|---|---|---|
cubemars_joint1_can_interface |
can0 |
SocketCAN interface for joint 1. |
cubemars_joint1_can_id |
1 |
CubeMars motor CAN ID. |
cubemars_joint1_trq_limit |
60.0 |
Joint 1 torque limit. |
unitree_device |
/dev/ttyarm |
Serial device for the Unitree motor. |
unitree_joint2_motor_id |
7 |
Unitree motor ID for joint 2. |
dji_device |
can0 |
SocketCAN interface for the DJI motor controller. |
dji_joint3_motor_id |
1 |
DJI motor ID for joint 3. |
tool_serial_port |
/dev/ttyserial |
Serial device for the suction/tool controller. |
gravity_compensation_enabled |
false |
Enables the gravity compensation node. |
CubeMars AK-series single-motor position launch:
ros2 launch cubemars_hardware ak80_8_position.launch.py \
can_interface:=can0 \
can_id:=1 \
trq_limit:=3.0 \
vel_limit:=0.5 \
acc_limit:=1.0
ros2 topic pub --once /ak80_position_controller/commands \
std_msgs/msg/Float64MultiArray "{data: [0.1]}"Unitree single-motor launch:
ros2 launch unitree_hardware single_motor.launch.py \
serial_interface:=/dev/ttyUSB0 \
motor_id:=0DJI 2006 standalone discovery and hold test:
ros2 run dji_hardware m3508_standalone_test --mode discover --port can0
ros2 run dji_hardware m3508_standalone_test \
--mode hold \
--controller cascade \
--motor-id 1 \
--port can0 \
--duration 5 \
--sample-hz 200Standalone DJI SocketCAN ROS 2 node; the package name still uses m3508_ros2_sdk:
ros2 launch m3508_ros2_sdk m3508.launch.py
ros2 topic pub --once /m3508/command \
std_msgs/msg/Float32MultiArray "{data: [1, 2, 0]}"/m3508/command uses [motor_id, mode, target]. Modes are 0 velocity PID, 1 position PID, 2 open-loop current, 3 cascade PID, and 4 torque.
| Service | Type | Purpose |
|---|---|---|
/move_to_position_direct |
arm_moveit_config_grand_new23/srv/MoveToPosition |
Direct named-pose execution through FollowJointTrajectory. |
/move_to_position |
arm_moveit_config_grand_new23/srv/MoveToPosition |
Higher-level block-storage/task flow with suction transitions. |
/execute_named_sequence |
arm_moveit_config_grand_new23/srv/ExecuteNamedSequence |
Execute an ordered list of named poses with per-pose durations. |
/set_block_storage_state |
arm_moveit_config_grand_new23/srv/SetBlockStorageState |
Reset or seed the internal block-storage state machine. |
/set_suction |
std_srvs/srv/SetBool |
Enable or disable the main suction output. |
/set_top_suction |
std_srvs/srv/SetBool |
Enable or disable the top suction output. |
MoveToPosition.srv:
int32 pose_id
bool pose_flag
---
bool success
string message
ExecuteNamedSequence.srv:
string[] pose_names
float64[] durations
---
bool success
string message
Workspace sampling plot:
ros2 run arm_moveit_config_grand_new23 plot_xyz_service_workspace.py \
--output /tmp/arm_new23_workspace.png \
--summary /tmp/arm_new23_workspace.jsonPayload pose debugging helper:
ros2 run arm_moveit_config_grand_new23 payload_box_pose_debug_standalone.pyJoint/controller monitors:
ros2 run arm_moveit_config_grand_new23 joint_angle_monitor.py
ros2 run arm_moveit_config_grand_new23 trajectory_state_monitor.py
ros2 run arm_moveit_config_grand_new23 controller_state_monitor.pyThis is my personal open-source arm-control workspace. The goal is to keep the project useful for other ROS 2 users while still documenting the real hardware assumptions behind this build.
- Repository-level source code is released under the MIT License.
- The current tested stack is Ubuntu 22.04 + ROS 2 Humble, using DJI 2006, Unitree Go-M8010-6, and CubeMars AK80 motors.
- Third-party packages, vendor SDKs, binary libraries, and generated assets retain their own upstream license terms.
- Do not commit generated outputs such as
build/,install/,log/, and__pycache__/. - Keep hardware-specific device paths, motor IDs, offsets, current limits, and serial commands configurable through launch arguments whenever possible.
Issues, questions, and pull requests are welcome. If a change touches real hardware behavior, please include enough context for me and other users to reproduce it safely:
- Ubuntu and ROS 2 versions used for testing, preferably Ubuntu 22.04 + ROS 2 Humble;
- motor/controller model and transport used during validation, such as DJI 2006 over SocketCAN, Unitree Go-M8010-6 over serial, or CubeMars AK80 over SocketCAN;
- launch command or service call used to reproduce the behavior;
- safety-relevant limits, offsets, and calibration assumptions.
This repository is licensed under the MIT License. See LICENSE for details. For license questions, contact vidon@gmail.com.
Third-party components included under src/ keep their original license terms; check the relevant package manifests and bundled license files before redistribution.
Arm Control 是一个用于自定义 3 自由度机械臂的 ROS 2 工作区。项目集成了 MoveIt 2 规划、ros2_control 硬件接口、任务级服务节点、吸盘/末端工具串口控制,以及仿真和实机启动文件。
这个仓库适合希望在假控制仿真环境或真实混合硬件环境中运行该机械臂的机器人开发者使用。
- 提供
arm-new23三轴机械臂的 MoveIt 2 配置,包括 URDF/Xacro、SRDF、关节限制、运动学、控制器、RViz 配置和网格模型资源。 - 支持 CubeMars AK80、Unitree Go-M8010-6 和 DJI 2006 电机的 ros2_control 硬件接口。
- 提供作品集/演示用启动流程,可启动假 ros2_control、MoveIt、RViz、任务服务和模拟吸盘服务。
- 提供实机启动流程:关节 1 使用 CubeMars AK80 + SocketCAN,关节 2 使用 Unitree Go-M8010-6 + 串口,关节 3 使用 DJI 2006 + SocketCAN。
- 提供任务级 Python 服务,用于命名位姿执行、积木/物块存取流程、吸盘控制、启动抬升、重力补偿、轨迹监控和工作空间调试。
| 路径 | 作用 |
|---|---|
src/arm-new23 |
基础机器人描述包,包含 URDF、网格模型、RViz 配置和展示启动文件。 |
src/arm_moveit_config_grand_new23 |
主要 MoveIt 2 包,包含控制器配置、启动文件、自定义服务和任务编排脚本。 |
src/cubemars_hardware |
基于 SocketCAN 的 CubeMars AK 系列 ros2_control SystemInterface;本机械臂实测 AK80。 |
src/unitree_hardware |
基于串口的 Unitree 电机 ros2_control SystemInterface;本机械臂实测 Go-M8010-6。 |
src/dji_hardware |
DJI ros2_control 硬件接口和独立 SocketCAN 测试程序;本机械臂实测 DJI 2006。 |
src/new_dj_sdk/src/m3508_ros2_sdk |
独立的 DJI SocketCAN ROS 2 驱动,包名沿用 M3508/C620;本工作区用它控制 DJI 2006。 |
src/unitree_actuator_sdk |
打包后的 Unitree actuator SDK 库和头文件。 |
主工作区面向 Ubuntu 22.04 + ROS 2 Humble。其他 ROS 2 发行版可能也可以运行,但包名、MoveIt 行为和控制器 API 可能需要调整。
目前实机验证过的硬件组合:
- 关节 1:CubeMars AK80,SocketCAN 通信。
- 关节 2:Unitree Go-M8010-6,串口通信。
- 关节 3:DJI 2006,SocketCAN 通信。
推荐系统依赖:
sudo apt update
sudo apt install -y \
python3-colcon-common-extensions \
python3-rosdep \
python3-serial \
can-utils \
ros-humble-desktop \
ros-humble-moveit \
ros-humble-ros2-control \
ros-humble-ros2-controllers \
ros-humble-xacro \
ros-humble-rviz2 \
ros-humble-warehouse-ros-mongo如果当前机器还没有初始化 rosdep:
sudo rosdep init
rosdep update在工作区根目录运行:
source /opt/ros/humble/setup.bash
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source install/setup.bash如果只想构建文档/演示相关的核心包,可以先编译机器人描述和 MoveIt 配置:
colcon build --symlink-install --packages-select arm-new23 arm_moveit_config_grand_new23
source install/setup.bash没有接入真实硬件时,建议先运行这个流程。它会启动 MoveIt、RViz、假 ros2_control、任务服务和模拟吸盘服务。
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch arm_moveit_config_grand_new23 portfolio_sim.launch.py无 RViz 模式:
ros2 launch arm_moveit_config_grand_new23 portfolio_sim.launch.py use_rviz:=false常用服务调用:
ros2 service call /move_to_position_direct \
arm_moveit_config_grand_new23/srv/MoveToPosition \
"{pose_id: 2, pose_flag: true}"
ros2 service call /execute_named_sequence \
arm_moveit_config_grand_new23/srv/ExecuteNamedSequence \
"{pose_names: ['startup_raise', 'pose_to_grand'], durations: [2.0, 3.0]}"
ros2 service call /set_block_storage_state \
arm_moveit_config_grand_new23/srv/SetBlockStorageState \
"{state: 0}"真实硬件运动有风险。运行任何会驱动电机的命令前,请固定机械臂、清空工作空间、确认急停可用,并先使用保守的扭矩/电流限制。
原生 SocketCAN 接口:
sudo ip link set can0 down || true
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up
candump can0CANable/CANable2 的 SLCAN 模式,需要把 /dev/ttyACM0 替换成实际设备路径:
bash src/new_dj_sdk/src/m3508_ros2_sdk/scripts/setup_canable2_slcan.sh /dev/ttyACM0 can0
ip link show can0整机启动会连接 MoveIt、ros2_control、各硬件接口、任务服务、末端工具串口桥接和可选重力补偿。
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch arm_moveit_config_grand_new23 demo.launch.py \
use_rviz:=true \
cubemars_joint1_can_interface:=can0 \
unitree_device:=/dev/ttyarm \
dji_device:=can0 \
tool_serial_port:=/dev/ttyserial常用硬件参数:
| 参数 | 默认值 | 含义 |
|---|---|---|
cubemars_joint1_can_interface |
can0 |
关节 1 使用的 SocketCAN 接口。 |
cubemars_joint1_can_id |
1 |
CubeMars 电机 CAN ID。 |
cubemars_joint1_trq_limit |
60.0 |
关节 1 扭矩限制。 |
unitree_device |
/dev/ttyarm |
Unitree 电机串口设备。 |
unitree_joint2_motor_id |
7 |
关节 2 的 Unitree 电机 ID。 |
dji_device |
can0 |
DJI 电机控制器使用的 SocketCAN 接口。 |
dji_joint3_motor_id |
1 |
关节 3 的 DJI 电机 ID。 |
tool_serial_port |
/dev/ttyserial |
吸盘/末端工具控制器串口。 |
gravity_compensation_enabled |
false |
是否启用重力补偿节点。 |
CubeMars AK 系列单电机位置控制:
ros2 launch cubemars_hardware ak80_8_position.launch.py \
can_interface:=can0 \
can_id:=1 \
trq_limit:=3.0 \
vel_limit:=0.5 \
acc_limit:=1.0
ros2 topic pub --once /ak80_position_controller/commands \
std_msgs/msg/Float64MultiArray "{data: [0.1]}"Unitree 单电机启动:
ros2 launch unitree_hardware single_motor.launch.py \
serial_interface:=/dev/ttyUSB0 \
motor_id:=0DJI 2006 独立发现与保持测试:
ros2 run dji_hardware m3508_standalone_test --mode discover --port can0
ros2 run dji_hardware m3508_standalone_test \
--mode hold \
--controller cascade \
--motor-id 1 \
--port can0 \
--duration 5 \
--sample-hz 200独立 DJI SocketCAN ROS 2 节点;包名仍沿用 m3508_ros2_sdk:
ros2 launch m3508_ros2_sdk m3508.launch.py
ros2 topic pub --once /m3508/command \
std_msgs/msg/Float32MultiArray "{data: [1, 2, 0]}"/m3508/command 使用 [motor_id, mode, target] 格式。模式含义:0 速度 PID,1 位置 PID,2 开环电流,3 串级 PID,4 力矩控制。
| 服务 | 类型 | 用途 |
|---|---|---|
/move_to_position_direct |
arm_moveit_config_grand_new23/srv/MoveToPosition |
通过 FollowJointTrajectory 直接执行命名位姿。 |
/move_to_position |
arm_moveit_config_grand_new23/srv/MoveToPosition |
带吸盘切换的高层物块存取/任务流程。 |
/execute_named_sequence |
arm_moveit_config_grand_new23/srv/ExecuteNamedSequence |
按顺序执行多个命名位姿,并为每个位姿指定持续时间。 |
/set_block_storage_state |
arm_moveit_config_grand_new23/srv/SetBlockStorageState |
重置或设置物块存取状态机。 |
/set_suction |
std_srvs/srv/SetBool |
开关主吸盘输出。 |
/set_top_suction |
std_srvs/srv/SetBool |
开关顶部吸盘输出。 |
MoveToPosition.srv:
int32 pose_id
bool pose_flag
---
bool success
string message
ExecuteNamedSequence.srv:
string[] pose_names
float64[] durations
---
bool success
string message
工作空间采样图:
ros2 run arm_moveit_config_grand_new23 plot_xyz_service_workspace.py \
--output /tmp/arm_new23_workspace.png \
--summary /tmp/arm_new23_workspace.json负载/物块局部位姿调试工具:
ros2 run arm_moveit_config_grand_new23 payload_box_pose_debug_standalone.py关节和控制器监控工具:
ros2 run arm_moveit_config_grand_new23 joint_angle_monitor.py
ros2 run arm_moveit_config_grand_new23 trajectory_state_monitor.py
ros2 run arm_moveit_config_grand_new23 controller_state_monitor.py这是我个人开源的机械臂控制工作区。项目会尽量保持对其他 ROS 2 用户有参考价值,同时也把这套实机硬件的假设写清楚。
- 仓库级源代码使用 MIT License 发布。
- 当前主要验证环境是 Ubuntu 22.04 + ROS 2 Humble,实机电机包括 DJI 2006、Unitree Go-M8010-6 和 CubeMars AK80。
- 第三方包、厂商 SDK、二进制库和生成资产保留其各自的上游许可证条款。
- 不要把
build/、install/、log/、__pycache__/等生成文件提交进版本库。 - 硬件相关的设备路径、电机 ID、偏置、电流限制和串口命令,尽量通过 launch 参数配置。
欢迎提交 issue、问题反馈和 pull request。如果修改会影响真实硬件行为,请尽量提供足够的信息,方便我和其他使用者安全复现:
- 测试使用的 Ubuntu 和 ROS 2 版本,优先说明是否为 Ubuntu 22.04 + ROS 2 Humble;
- 验证过的电机/控制器型号和通信方式,例如 DJI 2006 + SocketCAN、Unitree Go-M8010-6 + 串口、CubeMars AK80 + SocketCAN;
- 复现行为所用的启动命令或服务调用;
- 与安全相关的限制、偏置和标定假设。
本仓库使用 MIT License 发布,详见 LICENSE。许可证相关问题可联系 vidon@gmail.com。
src/ 下包含的第三方组件保留其原始许可证条款;再分发前请检查对应 package manifest 和随附 license 文件。