A 5-DOF robotic arm control system built with ROS 2 Jazzy. Includes a full URDF model, inverse kinematics RViz2 visualization, and serial-based hardware control.
The servo controller firmware for the Raspberry Pi Pico 2 W can be found at: https://github.com/Alex2099v1/robot_arm_servo_controller_pico_2_w.git
Demo https://1drv.ms/v/c/048efd32408a70aa/IQBfpBvsnmtiQrK9WX3TaLu8Af29Z9VlUHo4_qVj00BZSW8?e=J8tdEw
This repository contains three ROS 2 packages:
| Package | Description |
|---|---|
robot_arm_asm_description |
URDF/Xacro robot model, meshes, and simulation launch files |
robot_arm_main |
Control nodes: joint controller, IK solver, and demo |
robot_arm_inferences |
ROS 2 service interface definitions |
table (fixed) → base_link → motor1 → arm_base_plate → motor_base →
motor2 → arm_link1 → motor3 → arm_link2 → motor4 → gripper_base →
motor5 → gripper_rot → motor6 → gripper + end_effector
6 revolute joints (dof1–dof5 + gripper), each with ±π/2 rad limits.
Contains the full robot description and visualization tools.
- URDF/Xacro:
urdf/robot_arm_asm.xacro— 20 links, 6 joints, with inertial and collision properties - Meshes: STL files for all links (base, motors, arm links, gripper assembly)
- Launch files:
display.launch.py— RViz2 visualization with joint state publisher GUI
Core control logic.
joint_controller— Manages serial communication with the Pico 2 W servo controller. Publishes/joint_states, exposesset_jointservice. Reads motor config (reversals, home angles) fromconfig/servo.yaml.ik_node— Cartesian pose-based control viaik_xyzservice. Uses Pinocchio for IK with random restarts. Publishes goal markers to RViz2.demo_node— Runs a pre-programmed motion sequence to demonstrate arm capabilities.
Service definitions:
SetAngle.srv— Command a single joint by name with angle, velocity, and acceleration.GoTo.srv— Command the arm to a Cartesian pose (position + quaternion); IK is solved internally.
- Controller: Raspberry Pi Pico 2 W running custom servo firmware (see link above)
- Connection: USB serial
- Protocol: The host sends
<joint_name> <angle> <velocity> <acceleration>\n; the controller replies with current joint angles orcompleted/errorstatus.
serial_port: /dev/ttyACM0
motors:
dof1:
reversed: false
start: 0.0 # home position in radians
dof2:
reversed: false
start: 0.0
dof3:
reversed: true
start: 0.0
# ... dof4, dof5, gripper- ROS 2 Jazzy
- Python 3.12
pinocchio(for IK)pyserial
mkdir -p ~/ros_ws/src
cd ~/ros_ws/src
git clone <this-repo>
cd ~/ros_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build
source install/setup.bashVisualize in RViz2 (no hardware needed):
ros2 launch robot_arm_asm_description display.launch.pyRun on real hardware:
ros2 launch robot_arm_main arm_launch.launch.pyRun the demo sequence:
ros2 run robot_arm_main demo_nodeSend a joint command manually:
ros2 service call /set_joint robot_arm_inferences/srv/SetAngle "{joint: 'dof1', angle: 0.5, velocity: 50, acceleration: 20}"Send a Cartesian goal:
ros2 service call /ik_xyz robot_arm_inferences/srv/GoTo "{x: 0.2, y: 0.0, z: 0.3, qx: 0.0, qy: 0.0, qz: 0.0, qw: 1.0}"A Docker image is built and published automatically via GitHub Actions on push to master. It targets linux/arm64 (for deployment on ARM-based hardware).
Build locally:
docker build -t robot_arm .Run:
docker run --rm -it --device=/dev/ttyACM0 robot_arm bashThe container uses the ubuntu user with dialout group access for serial communication.