Transform real-world point clouds into interactive MuJoCo robot simulations. This project demonstrates a complete pipeline from 3D reconstruction to physics simulation.
Input: Point cloud file (data/point_clouds/bunny.pcd) OR Live camera feed
Output: Interactive MuJoCo simulation with Franka robot + reconstructed object(s)
- 3D Reconstruction - Convert point cloud to mesh using Poisson surface reconstruction
- Model Integration - Combine reconstructed object with robot model
- Physics Simulation - Launch interactive MuJoCo viewer
- Live Integration - Real-time camera feeds with dynamic simulation updates
WORKING: Complete end-to-end pipeline from static files to real-time camera integration
- [DONE] 3D reconstruction:
bunny.pcd→bunny_final.stl(469KB mesh) - [DONE] Scene loading: 13 bodies, 16 DOF, 68 meshes, 8 actuators
- [DONE] Interactive simulation: MuJoCo viewer with robot + reconstructed bunny
- [DONE] Phase 3A: Robot control and manipulation of reconstructed objects
- [DONE] Phase 3B: Object segmentation and multi-object reconstruction
- [DONE] Phase 4: Real camera integration with live object detection
Experience the complete Real2Sim pipeline with a professional robot arm:
# Run the main demo (from project root)
mjpython examples/franka_panda_real2sim_demo.py
# Choose option 1 for interactive exploration
# Choose option 2 for automatic manipulation sequenceWhat you'll see:
- Real Franka Emika Panda robot (industry-standard research robot)
- Real 3D scanned mustard bottle (from Yale-CMU-Berkeley Object Dataset)
- 10-step manipulation sequence: Home → Approach → Grasp → Lift → Move → Place → Release → Return
- Full physics simulation with proper dynamics, friction, and collision detection
# Clone the repository
git clone https://github.com/ChesterCaii/Real2Sim_Project.git
cd Real2Sim_Project
# Activate virtual environment (recommended)
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt# Phase 1: 3D Reconstruction
python run_pipeline.py 1
# Phase 2: Simulation
python run_pipeline.py 2
# Phase 3A: Robot Control
python run_pipeline.py 3a
# Phase 3B: Multi-Object Reconstruction
python run_pipeline.py 3b
# Phase 4: Camera Integration
python run_pipeline.py 4
# Phase 4: Live Simulation Bridge
python run_pipeline.py 4 --live
# Run Tests
python run_pipeline.py testStep 1: 3D Reconstruction (Static)
python src/reconstruction/reconstruct_mesh.pyConverts data/point_clouds/bunny.pcd → data/meshes/bunny_final.stl
Step 2: Launch Simulation (Static)
# On macOS (recommended):
mjpython src/simulation/run_real2sim.py
# On Linux/Windows:
python src/simulation/run_real2sim.pyExpected Result: Interactive MuJoCo viewer with Franka robot and reconstructed bunny
Step 3: Robot Control (Phase 3A)
# Autonomous manipulation demonstration:
mjpython src/control/robot_control_demo.py
# Interactive joint control:
mjpython src/control/interactive_robot_control.pyExpected Result: Robot arm moves through manipulation sequences, interacting with reconstructed object
Step 4: Object Segmentation & Multi-Object Scenes (Phase 3B)
# Object segmentation using SAM:
python src/reconstruction/object_segmentation.py
# Multi-object 3D reconstruction:
python src/reconstruction/reconstruct_multi_objects.py
# Test multi-object simulation:
mjpython src/simulation/test_multi_object_scene.pyExpected Result: Multiple objects automatically segmented, reconstructed in 3D, and simulated together
Step 5: Live Camera Integration (Phase 4) 🆕
# Test camera setup:
python tests/test_camera_integration.py
# Live object detection only:
python src/live/camera_integration.py
# Full live simulation bridge:
python src/live/live_simulation_bridge.pyExpected Result: Real-time camera feed → object detection → 3D reconstruction → dynamic simulation updates
- Mouse: Rotate camera
- Right-click + drag: Pan camera
- Scroll: Zoom in/out
- Space: Pause/unpause physics
- Ctrl+R: Reset simulation
- Q: Quit (in camera windows)
reconstruction/- Phase 1 & 3B: 3D reconstruction and object segmentationreconstruct_mesh.py- Main 3D reconstruction from point cloud to meshobject_segmentation.py- SAM-based automatic object detectionreconstruct_multi_objects.py- Multi-object 3D reconstructionsimplify_meshes.py- Mesh optimization for MuJoCo compatibility
simulation/- Phase 2: MuJoCo simulation integrationrun_real2sim.py- Main simulation launcher (clean interface)fixed_simulation.py- Detailed debugging versiontest_multi_object_scene.py- Multi-object simulation testing
control/- Phase 3A: Robot control and manipulationrobot_control_demo.py- Autonomous robot manipulation demonstrationinteractive_robot_control.py- Manual robot joint control interface
live/- Phase 4: Real-time camera integration 🆕camera_integration.py- Real-time RGB-D camera processing with live object detectionlive_simulation_bridge.py- Bridge between live camera and dynamic MuJoCo simulation
data/- Input data and assetspoint_clouds/- Point cloud files (.pcd,.ply)meshes/- 3D mesh files (.stl)scenes/- MuJoCo scene XML files
models/- Machine learning modelssam_vit_b.pth- Segment Anything Model checkpoint
outputs/- Generated outputssegmented_objects/- Object segmentation resultsreconstructed_objects/- 3D reconstruction outputs
tests/- Test suites and validationtest_camera_integration.py- Camera setup and component testing
examples/- Example scripts and legacy codedocs/- Documentation and images
mujoco_menagerie/- High-quality robot models from Google DeepMind
- Intel RealSense D400 series (preferred - true RGB-D)
- Standard webcams (with synthetic depth generation)
- Auto-detection and fallback
- Live Object Detection: SAM or OpenCV background subtraction
- Streaming 3D Reconstruction: Point cloud → mesh conversion
- Dynamic Simulation Updates: Objects appear/disappear in simulation
- Multi-threaded Processing: Separate camera, detection, and simulation threads
- Real-time FPS: 15-30 FPS camera feed
- Detection Rate: 1-5 Hz object detection updates
- Simulation Updates: 1-2 Hz dynamic scene reloading
- Optimized for Speed: Reduced SAM parameters, mesh simplification
- Initial approach: Attempted to use non-existent
mj_mergeModels()function - Solution: Created unified XML scene combining robot and object definitions
- Result: Single simulation with 13 bodies, 16 DOF, 68 meshes, 8 actuators
- Challenge: Robot keyframes incompatible with additional object DOF
- Solution: Removed conflicting keyframes while preserving robot functionality
- Result: Stable simulation with proper physics integration
- Challenge: Complex mesh asset path resolution in MuJoCo
- Solution: Proper meshdir configuration and asset organization
- Result: All 68+ robot and object meshes load correctly
- Challenge: SAM too slow for real-time use (5-10 seconds per frame)
- Solution: Optimized parameters, background subtraction fallback, multi-threading
- Result: Real-time object detection at 15+ FPS
- Bodies: 13+ (12 robot + 1+ reconstructed objects)
- Degrees of Freedom: 16+ (7 arm + 2 gripper + 6 object free joint + 1 world)
- Meshes: 68+ (visual and collision meshes for detailed robot + dynamic objects)
- Actuators: 8 (7 joint actuators + 1 gripper)
- Live Objects: Unlimited (limited by performance)
This pipeline enables research in:
- Sim-to-Real Transfer: Training policies in simulation with real object geometry
- Digital Twins: Creating digital replicas of real-world manipulation scenarios
- Robotic Grasping: Testing grasp strategies on reconstructed real objects
- Scene Understanding: Combining perception and interaction in robotics
- Live Adaptation: Real-time simulation updates based on changing environments
- Human-Robot Interaction: Dynamic object manipulation in shared workspaces
Suitable for learning:
- 3D reconstruction techniques
- MuJoCo physics simulation
- XML scene modeling
- Real-to-simulation pipelines
- Robotic manipulation setup
- Computer vision and object detection
- Real-time system integration
- Multi-threaded programming
- Single object reconstruction (bunny.pcd → bunny_final.stl)
- Static MuJoCo simulation integration
- Interactive viewer with robot + object
- Robot + object combined simulation
- Physics interaction and collision detection
- Stable multi-body dynamics
- 7 DOF arm control and gripper manipulation
- Smooth motion planning and execution
- Real-time feedback and monitoring
- Interactive control interfaces
- SAM-based object segmentation from images
- Individual 3D reconstruction of multiple objects
- Multi-object physics simulation (6 objects, 36 DOF)
- Mesh optimization for MuJoCo compatibility
- Live RGB-D camera feeds (Intel RealSense + webcam support)
- Real-time object detection (SAM + OpenCV background subtraction)
- Streaming 3D reconstruction (point cloud → mesh → simulation)
- Dynamic simulation updates (objects appear/disappear in real-time)
- Multi-threaded architecture (camera, detection, simulation threads)
- Performance optimization (15+ FPS camera, 1-2 Hz simulation updates)
- YOLO/DINO object classification (recognize specific object types)
- 6D pose estimation (precise object orientation)
- Semantic segmentation (understand object properties)
- Temporal consistency (object tracking across frames)
- Grasp planning based on reconstructed geometry
- Contact-rich manipulation with force feedback
- Task and motion planning integration
- Closed-loop visual servoing
- Multiple robots in shared workspace
- Human-robot collaboration with live human detection
- Distributed simulation across multiple computers
- Cloud-based processing for complex scenes
# Install Intel RealSense SDK
# Ubuntu/Debian:
sudo apt-get install librealsense2-dev
# macOS (Homebrew):
brew install librealsense
# Windows: Download from Intel website- Azure Kinect: Excellent depth quality, requires separate SDK
- Webcam + depth estimation: Works but limited accuracy
- Stereo cameras: Good for custom setups
# Download SAM checkpoint (358MB for vit_b) to models/ directory
cd models/
wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth
mv sam_vit_b_01ec64.pth sam_vit_b.pth
cd ..- Camera not detected: Check USB connection, install drivers
- SAM too slow: Use OpenCV fallback or smaller model
- Simulation crashes: Check mesh complexity, use simplify_meshes.py
- Memory issues: Reduce update rate, limit number of objects
- Use Intel RealSense for best RGB-D quality
- Enable GPU acceleration for SAM (CUDA)
- Adjust update rates based on system performance
- Close unnecessary applications during live demos
- MuJoCo: Physics simulation framework
- Open3D: 3D reconstruction and processing
- MuJoCo Menagerie: High-quality robot models
- Stanford Computer Graphics Laboratory: Bunny dataset
- Meta Research: Segment Anything Model (SAM)
- Intel: RealSense SDK and hardware support
This project is open source. Please see individual component licenses:
- MuJoCo Menagerie: Apache 2.0
- Open3D: MIT License
- SAM: Apache 2.0
Status: Complete Real-to-Simulation Pipeline with Live Camera Integration
Built for the robotics and computer vision community. Ready for research, education, and real-world applications! 🚀