Skip to content

rishit2904/Movement_Tracking_Mujoco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Movement Tracking MuJoCo is a cutting-edge project that harnesses the power of MuJoCo physics simulation combined with machine learning to create an intelligent humanoid movement analysis system. This project seamlessly integrates:

  • Advanced Physics Simulation using MuJoCo engine
  • LSTM-based Motion Prediction for movement forecasting
  • Real-time Visualization with interactive React frontend
  • Motion Tracking & Analysis for biomechanical research

Perfect for researchers in robotics, biomechanics, machine learning, and anyone interested in human movement simulation and prediction.

Table of Contents

Overview

This project simulates a humanoid model (e.g., humanoid.xml) using MuJoCo, tracks its motion, and employs an LSTM model to predict or analyze movement sequences. A React-based GUI allows users to interact with the simulation, load data, train models, and visualize results in real-time or post-processed formats.

โœจ Key Features

๐Ÿค– Simulation ๐Ÿง  AI/ML ๐ŸŽจ Visualization ๐Ÿ”ง Development
Realistic Physics LSTM Networks Real-time Rendering Modular Design
MuJoCo-powered humanoid simulation Motion prediction & forecasting Interactive 3D visualization Extensible architecture
Motion Capture Data Processing Web Interface Easy Integration
Joint tracking & analysis CSV data handling React-based GUI RESTful API endpoints

๐ŸŽฏ Core Capabilities

  • ๐Ÿƒโ€โ™‚๏ธ Advanced Humanoid Simulation

    • Realistic movement simulation using MuJoCo physics engine
    • Support for complex humanoid models and custom XML configurations
    • Real-time physics calculations with accurate collision detection
  • ๐Ÿ“Š Intelligent Motion Tracking

    • Captures joint angles, velocities, accelerations, and positions
    • Processes and analyzes biomechanical data
    • Exports motion data to CSV format for further analysis
  • ๐Ÿง  LSTM-based Prediction

    • Deep learning models for motion sequence prediction
    • Time-series analysis of movement patterns
    • Customizable neural network architectures
  • ๐ŸŽจ Interactive Visualization

    • Modern React-based web interface
    • Real-time 3D simulation rendering
    • Matplotlib integration for data plotting
    • Responsive design for all devices
  • ๐Ÿ”ฌ Research-Ready Platform

    • Modular design for easy customization
    • Support for custom sensors and algorithms
    • Comprehensive data export capabilities
    • Integration with popular ML frameworks

๐Ÿ“‹ Prerequisites

Component Version Purpose
Python 3.7+ Backend processing & ML
Node.js 16+ Frontend development
MuJoCo Latest Physics simulation

๐Ÿ”ง System Dependencies

  • MuJoCo Physics Engine - Installation Guide
  • Python Dependencies - Listed in backend/requirements.txt
  • Node.js Dependencies - Listed in frontend/package.json

๐Ÿ“ฆ Key Python Packages

tensorflow>=2.0    # Deep learning framework
numpy>=1.19        # Numerical computing
flask>=2.0         # Web framework
matplotlib>=3.3    # Data visualization
pandas>=1.2        # Data manipulation
mujoco>=2.0        # MuJoCo Python bindings

โšก Quick Setup

๐Ÿš€ One-Click Installation

# Clone the repository
git clone https://github.com/17arhaan/Movement_Tracking_Mujoco.git
cd Movement_Tracking_Mujoco

# Install everything at once
chmod +x setup.sh && ./setup.sh

๐Ÿ“ Manual Installation

๐Ÿ Backend Setup (Python)
# 1. Create virtual environment
python -m venv venv

# 2. Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
# venv\Scripts\activate

# 3. Install MuJoCo (follow official guide)
# https://mujoco.org/docs/installation.html

# 4. Install Python dependencies
pip install -r backend/requirements.txt

# 5. Verify installation
python backend/mujoco_sim.py
โš›๏ธ Frontend Setup (React)
# 1. Navigate to frontend directory
cd frontend

# 2. Install Node.js dependencies
npm install

# 3. Start development server
npm start

# 4. Open browser to http://localhost:3000
๐Ÿ” Verification Steps
  1. Check MuJoCo Installation:

    python -c "import mujoco; print('MuJoCo installed successfully!')"
  2. Verify Backend:

    cd backend && python api.py
    # Should start Flask server on http://localhost:5000
  3. Test Frontend:

    cd frontend && npm start
    # Should open React app on http://localhost:3000
  4. Ensure Model Files:

    • Place humanoid.xml in backend/ directory
    • Or adjust model paths in mujoco_sim.py

๐ŸŽฎ Usage Guide

๐Ÿš€ Getting Started (3 Simple Steps)

Step Action Command Result
1 ๐Ÿ”ง Start Backend cd backend && python api.py Flask server at localhost:5000
2 ๐ŸŽจ Launch Frontend cd frontend && npm start React app at localhost:3000
3 ๐ŸŽ‰ Start Exploring Open browser Interactive simulation interface

๐Ÿ–ฅ๏ธ Detailed Usage

Running the Backend

Launch the Flask API to manage simulation and LSTM processing:

cd backend
python api.py

The server runs at http://localhost:5000.

Running the Frontend

Start the React GUI:

cd frontend
npm start

Visit http://localhost:3000 to access the interface.

Running Standalone Simulation (Optional)

To run a standalone MuJoCo simulation without the GUI:

cd backend
python mujoco_sim.py

This renders the humanoid model with dummy joint angles.

Training the LSTM Model

The GUIโ€™s "Train LSTM" button triggers training via the API. Alternatively, run standalone:

cd backend
python lstm_model.py

Modify lstm_model.py to load your dataset.

Visualization

The GUIโ€™s "Simulate Motion" button renders MuJoCo output. For standalone plots:

cd backend
python motion_tracker.py  # Add Matplotlib plotting logic here

๐Ÿ—๏ธ Project Architecture

graph TB
    subgraph Frontend["๐ŸŽจ Frontend (React)"]
        UI[Web Interface]
        Controls[Motion Controls]
        Viz[3D Visualizer]
    end
    
    subgraph Backend["๐Ÿ”ง Backend (Python)"]
        API[Flask API]
        Sim[MuJoCo Simulator]
        LSTM[LSTM Models]
        Tracker[Motion Tracker]
    end
    
    subgraph Data["๐Ÿ“Š Data Layer"]
        XML[XML Models]
        CSV[Motion Data]
        Models[Trained Models]
    end
    
    UI --> API
    Controls --> Sim
    Viz --> Tracker
    API --> LSTM
    Sim --> XML
    Tracker --> CSV
    LSTM --> Models
Loading

๐Ÿ“ Directory Structure

Movement_Tracking_Mujoco/
โ”œโ”€โ”€ ๐Ÿ”ง backend/                        # Python backend ecosystem
โ”‚   โ”œโ”€โ”€ ๐ŸŽฏ api.py                     # Flask RESTful API server
โ”‚   โ”œโ”€โ”€ ๐Ÿค– mujoco_sim.py              # MuJoCo physics simulation engine
โ”‚   โ”œโ”€โ”€ ๐Ÿง  lstm_model.py              # Deep learning model architecture
โ”‚   โ”œโ”€โ”€ ๐Ÿ“Š motion_tracker.py          # Motion capture & analysis
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt           # Python dependency specifications
โ”‚   โ””โ”€โ”€ ๐Ÿ—‚๏ธ models/                   # Trained model storage
โ”‚
โ”œโ”€โ”€ ๐ŸŽจ frontend/                       # React web application
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฑ src/
โ”‚   โ”‚   โ”œโ”€โ”€ โš›๏ธ App.js                # Main application component
โ”‚   โ”‚   โ”œโ”€โ”€ ๐ŸŽฎ MotionControl.js       # Simulation control interface
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Visualizer.js         # Real-time visualization
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ”— index.js              # Application entry point
โ”‚   โ”‚   โ””โ”€โ”€ ๐ŸŽจ styles/               # CSS styling
โ”‚   โ”œโ”€โ”€ ๐ŸŒ public/
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ index.html            # HTML template
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ assets/              # Static assets
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฆ package.json              # Node.js dependencies
โ”‚   โ””โ”€โ”€ ๐Ÿ”ง build/                    # Production build output
โ”‚
โ”œโ”€โ”€ ๐Ÿค– models/                         # MuJoCo model definitions
โ”‚   โ”œโ”€โ”€ ๐Ÿšถ humanoid.xml             # Human biomechanical model
โ”‚   โ”œโ”€โ”€ ๐ŸŽฏ environments/             # Custom environments
โ”‚   โ””โ”€โ”€ ๐Ÿ”ง configs/                  # Model configurations
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š data/                          # Training & simulation data
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ˆ training/                 # LSTM training datasets
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‰ results/                  # Simulation outputs
โ”‚   โ””โ”€โ”€ ๐Ÿ”„ logs/                     # System logs
โ”‚
โ”œโ”€โ”€ ๐Ÿงช test_cases/                    # Development test scenarios
โ”‚   โ”œโ”€โ”€ ๐Ÿงช test1/                    # Basic simulation tests
โ”‚   โ”œโ”€โ”€ ๐Ÿงช test2/                    # Advanced ML workflows
โ”‚   โ””โ”€โ”€ ๐Ÿงช test3/                    # Integration tests
โ”‚
โ”œโ”€โ”€ ๐Ÿ“š docs/                          # Documentation
โ”‚   โ”œโ”€โ”€ ๐Ÿ“– api.md                    # API documentation
โ”‚   โ”œโ”€โ”€ ๐Ÿ”ฌ research.md               # Research methodology
โ”‚   โ””โ”€โ”€ ๐ŸŽฏ tutorials/                # User tutorials
โ”‚
โ”œโ”€โ”€ ๐Ÿ› ๏ธ scripts/                       # Utility scripts
โ”‚   โ”œโ”€โ”€ ๐Ÿš€ setup.sh                 # Automated setup
โ”‚   โ”œโ”€โ”€ ๐Ÿงน cleanup.py               # Data preprocessing
โ”‚   โ””โ”€โ”€ ๐Ÿ“Š analysis.py               # Data analysis tools
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE                        # MIT License
โ”œโ”€โ”€ ๐Ÿ“– README.md                      # This file
โ””โ”€โ”€ โš™๏ธ .gitignore                    # Git ignore patterns

๐Ÿ”„ Data Flow

  1. ๐ŸŒ User Interaction โ†’ React frontend captures user inputs
  2. ๐Ÿ“ก API Communication โ†’ Frontend sends requests to Flask backend
  3. ๐Ÿค– Physics Simulation โ†’ MuJoCo processes movement calculations
  4. ๐Ÿ“Š Data Processing โ†’ Motion tracker analyzes simulation output
  5. ๐Ÿง  ML Prediction โ†’ LSTM models process temporal sequences
  6. ๐ŸŽจ Visualization โ†’ Results rendered in real-time interface

Examples

Example 1: Simulate Random Motion

  • Start the backend (python backend/api.py).
  • Open the GUI (npm start in frontend/).
  • Click "Simulate Motion" to render a random humanoid pose.

Example 2: Train LSTM on Dummy Data

  • Run python backend/lstm_model.py standalone to train on random sequences.
  • Check the console for training progress and saved model (lstm_model.h5).

Example 3: Visualize Motion Data

  • Modify motion_tracker.py to output joint angles to a CSV.
  • Use Matplotlib in a custom script (e.g., visualize.py):
    import matplotlib.pyplot as plt
    import pandas as pd
    data = pd.read_csv("motion_data.csv")
    plt.plot(data["time"], data["joint_1"])
    plt.show()

Contributing

Contributions are encouraged! To contribute:

  1. Fork the repository.
  2. Create a branch (git checkout -b feature/your-feature).
  3. Commit changes (git commit -m "Add your feature").
  4. Push to the branch (git push origin feature/your-feature).
  5. Submit a pull request.

For significant changes, open an issue first. Adhere to the projectโ€™s coding style and document new features.

๐Ÿš€ Built with passion for advancing human movement simulation

Made with โค๏ธ by Arhaan

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors