A basic ROS 2 (Jazzy) workspace containing a simple 3-link robotic arm with a 2-finger gripper, modeled in URDF/Xacro using primitive shapes (cylinders and boxes) and visualized in RViz2.
This workspace defines simple_3_link_arm: a robotic arm built from a cylindrical base, three revolute links, and a fixed-mount parallel gripper with two prismatic fingers. It's a learning/tutorial-style project for understanding URDF/Xacro structure, link/joint definitions, and RViz2 visualization in ROS 2 — with no Gazebo, ros2_control, or MoveIt2 integration (yet).
- ROS 2 Jazzy (Ubuntu 24.04)
- URDF / Xacro — robot structure definition
- RViz2 — visualization
robot_state_publisher+joint_state_publisher_gui— publishing TF and manual joint control- ament_cmake — package build system
robotic_arm_urdf_ws/
├── robot_description/ # Robot model package
│ ├── urdf/
│ │ └── robot.urdf.xacro # Xacro definition of simple_3_link_arm
│ ├── launch/
│ │ └── robot_rviz.launch.py # Launches robot_state_publisher, joint_state_publisher_gui, and RViz2
│ ├── rviz/
│ │ └── simple_arm.rviz # Pre-configured RViz view (Fixed Frame: base_link)
│ ├── CMakeLists.txt
│ └── package.xml
├── robot_ros2/ # Metapackage (depends on robot_description)
│ ├── CMakeLists.txt
│ └── package.xml
├── LICENSE # Apache License 2.0
└── README.md
The arm (simple_3_link_arm) consists of:
| Link | Shape | Notes |
|---|---|---|
base_link |
Cylinder (r=0.1, l=0.05) | Mass 5.0 kg |
link1 |
Cylinder (r=0.04, l=0.4) | Mass 2.0 kg |
link2 |
Cylinder (r=0.04, l=0.3) | Mass 1.5 kg |
link3 |
Cylinder (r=0.04, l=0.25) | Mass 1.0 kg |
gripper_base |
Box (0.05 × 0.05 × 0.02) | Mass 0.5 kg, fixed to link3 |
left_finger / right_finger |
Box (thin, 0.08 m long) | Mass 0.1 kg each |
| Joint | Type | Parent → Child | Axis | Limits |
|---|---|---|---|---|
joint1 |
revolute | base_link → link1 |
Z | ±3.14 rad |
joint2 |
revolute | link1 → link2 |
Y | 0.50 to 2.09 rad |
joint3 |
revolute | link2 → link3 |
Y | 0 to 2.35 rad |
gripper_joint |
fixed | link3 → gripper_base |
— | — |
left_finger_joint |
prismatic | gripper_base → left_finger |
Y | 0 to 0.016 m |
right_finger_joint |
prismatic | gripper_base → right_finger |
−Y | 0 to 0.016 m |
So the arm has 3 revolute joints (shoulder yaw, shoulder/elbow pitch x2) plus a 2-finger prismatic gripper, all defined with visual, collision, and inertial properties — no mesh files, purely primitive geometry (cylinders/boxes).
- Ubuntu 24.04
- ROS 2 Jazzy installed (installation guide)
joint_state_publisher_guiandxacro:sudo apt install ros-jazzy-joint-state-publisher-gui ros-jazzy-xacro
-
Clone the repository into a Colcon workspace
srcfolder:mkdir -p ~/ros2_ws/src cd ~/ros2_ws/src git clone https://github.com/ilovevampire/robotic_arm_urdf_ws.git .
(Note: the repo itself contains the packages directly at its root —
robot_description/androbot_ros2/— rather than nesting them under asrc/folder, so clone it directly into your workspace'ssrc/directory as shown above.) -
Build the workspace:
cd ~/ros2_ws colcon build --symlink-install source install/setup.bash
Launch the robot model in RViz2 with manual joint control:
ros2 launch robot_description robot_rviz.launch.pyThis starts:
robot_state_publisher— parsesrobot.urdf.xacrovia thexacrocommand and publishesrobot_description+ TFjoint_state_publisher_gui— opens a slider GUI to manually move each joint (joint1,joint2,joint3, and the two finger joints)rviz2— opens with the pre-configuredsimple_arm.rvizview (Fixed Frame set tobase_link, with Grid, TF, and RobotModel displays enabled)
Use the slider window to rotate the arm's joints and open/close the gripper fingers, and watch the model update live in RViz2.
- Add Gazebo simulation support (
ros2_control+gz_ros2_control). - Add a MoveIt2 configuration package for motion planning.
- Replace primitive-shape visuals with proper mesh files for a more realistic appearance.
- Flesh out
robot_ros2as a full metapackage (it currently only depends onrobot_description). - Fill in package descriptions/licenses in
package.xml(currently markedTODO).
Apache License 2.0 — see LICENSE for details.