Digital Twin & CPS Development for UR5e Robotic Arm | ROS2 + Unity 3D GitHub Link YouTube Link
Developed a real-time digital twin framework for the UR5e 6-axis robotic arm using ROS2 Humble, Gazebo, RViz, and Unity 3D. The Unity scene mirrors live joint states from Gazebo via ROS-TCP-Connector bridge, with a custom UI overlay displaying live joint angles, machine status, and labeled world axes. Key achievements include bidirectional control from Unity UI sliders to Gazebo, a multi-machine virtual lab with UR5e arm and conveyor belt synchronized simultaneously, ML-based anomaly detection on joint states with live Unity alerts, latency measurement and analysis, and rosbag2 motion recording with verified replay. Reinforcement learning-based control is currently under development.
Tech Stack: ROS2 Humble, Ubuntu 22.04, Unity 2022, Python, C#, URDF, Gazebo, RViz, ROS-TCP-Connector, scikit-learn
System Architecture: Base
System Architecture: Bidirectional ROS2–Unity Communication Pipeline
UR5e 6-axis arm in RViz with live joint states .
UR5e spawned in Gazebo physics simulation
UR5e 3D model in Unity scene and ROS-TCP Bridge Connection
Digital Twin Demo: ROS2 → Unity real-time sync
Unity Inspector — Full System Components
Multi-Machine Gazebo Simulation — UR5e Arm and Conveyor Belt
Complete Digital Twin — Gazebo + Unity Real-time Sync
Unity→ROS2 Bidirectional Control — Joint Commands via Terminal
Bidirectional Control — Unity Sliders Controlling Gazebo Robot Arm
Conveyor Belt Speed Control from Unity UI
Multi-Machine Virtual Lab — Robot Arm + Conveyor Belt
ML-Based Anomaly Detection — Normal vs Abnormal Joint Motion
Anomaly Detector — Joint Deviation Warning in ROS2 Terminal
ML Anomaly Detection — Live Red Alert in Unity UI
ROS2–Unity Latency Analysis — Message Interval Distribution (Avg: 104.3ms)
Unity Console — Live Latency Measurement
ROS2–Unity TCP Bridge — All Topics Successfully Registered