This project demonstrates a complete robotic arm system using ROS 2 Humble, Gazebo, MoveIt 2, and YOLOv8. The system is built around a UR5 6-DOF robotic arm and includes simulation, motion planning, kinematics-based control, and vision-based object detection.
- 6-DOF UR5 robotic arm simulation
- MoveIt 2 integration for trajectory planning
- Custom inverse and forward kinematics implementation
- Joint angle control via ROS 2 publishers
- Simulated RGB-D camera mounted on robot
- YOLOv8 object detection on camera feed
| Task | Description | Demo |
|---|---|---|
| Task 1 | UR5 Simulation + MoveIt 2 | Watch Video |
| Task 2 | Kinematics Node (IK/FK) + Joint Control | Watch Video |
| Task 3 | Object Detection using Simulated Camera + YOLOv8 | Watch Video |
- Ubuntu 22.04
- ROS 2 Humble
- Gazebo (Fortress or compatible)
- Python 3.10+
ultralytics(YOLOv8)- OpenCV
cv_bridge,sensor_msgs,trajectory_msgsIKPy
pip install -r requirements.txtgit clone --recurse-submodules <repo-url>
cd ros2_ur5_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source install/setup.bashSimulates the UR5 robotic arm in Gazebo and visualizes it in RViz. Integrates MoveIt 2 to plan and execute trajectories.
ros2 launch ur5_sim spawn_ur5_moveit.launch.py/joint_states(Published)/tf(Published)/move_groupaction interface (MoveIt)
- You can use the interactive marker in RViz to set a new pose and click “Plan” and then “Execute”.
- TF and JointStatePublisher work in sync.
Implements forward and inverse kinematics using IKPy. Accepts 3D target position as input, computes joint angles, and publishes them to move the robot in Gazebo.
# Compute FK and IK
ros2 run ur5_kinematics ik_command_node --ros-args -p x:=0.5 -p y:=0.4 -p z:=0.8/joint_trajectory_controller/joint_trajectory(Published)/joint_states(Subscribed)
- The IK node loads the robot’s URDF dynamically.
- Uses 6 active links including wrist and base.
- You can send different XYZ goals for testing.
A simulated RGB camera is mounted on the robot’s end-effector in Gazebo. Captures live feed, runs YOLOv8 detection, and shows real-time bounding boxes using OpenCV.
ros2 run ur5_yolov8_detector yolo_node/camera/image_raw(Subscribed)cv2.imshow()(Pop-up detection window)- Terminal logs for object classes and confidence scores
- Uses
ultralyticsYOLOv8 model (e.g., yolov8n.pt) - Simulated camera is placed to view the objects on the table.
- You may add custom textures or PNG images to improve detection.
| File | Description |
|---|---|
spawn_ur5_moveit.launch.py |
Spawns robot in Gazebo + RViz + Launches MoveIt 2 |
ros2_ur5_ws/
├── src/
│ ├── ur5_sim/
│ ├── ur5_kinematics/
│ └── yolov8_detector/
├── install/
├── build/
├── log/
├── README.md
└── requirements.txt
- Use XYZ target values that are reachable by UR5.
- Make sure to position objects where the camera can see them.
- You can add more objects using SDF or include URDF models.
-
No detection output?
- Ensure camera is publishing
/image_raw - Add larger, common YOLOv8-detectable objects (bottle, cup)
- Ensure camera is publishing
-
CV Bridge error?
- Install with:
sudo apt install ros-humble-cv-bridge
- Install with:
- Universal Robots UR5 model
- MoveIt 2
- Gazebo Sim
- IKPy library
- YOLOv8 (Ultralytics)
Azhar Pathan azarpathan888@gmail.com