Skip to main content

Human to Robot Motion Transfer

Project description

DifoTrain Banner

DifoTrain

Human to Robot Motion Transfer

Python 3.13+ License Code style: black


Overview

DifoTrain is a comprehensive pipeline designed to capture human motion through webcam input, learn intelligent mappings to robot joint configurations, and control robotic systems to authentically imitate human movements in both simulated and real-world environments.

Features

Motion Capture

Real-time human pose estimation using Google MediaPipe Pose Landmarker for accurate motion tracking.

Representation

Standardized skeleton representation for human and robot states, enabling seamless data transfer.

Learning

Imitation learning module using PyTorch to map human joint positions and angles to robot commands.

Control

Robot controller integration with comprehensive PyBullet simulation support.

Installation

This project uses uv for dependency management, but standard pip works as well.

Prerequisites

  • Python 3.13 or higher
  • Webcam for motion recording

Setup

Step 1: Install Dependencies

Using uv (Recommended):

uv sync

Using pip:

pip install -r requirements.txt

Direct installation:

pip install mediapipe opencv-python numpy torch

Step 2: Download MediaPipe Model

The system requires the pose_landmarker_lite.task model file. Run the setup script to download it automatically:

python setup_mediapipe.py

Usage

1. Record Human Motion

Capture motion from your webcam. This saves a trajectory file to storage/human_trajectory.json.

python main.py record

Press q to stop recording.

2. Generate Dummy Data (Optional)

If you don't have a webcam, you can generate synthetic test data:

python -m tests.generate_dummy_data

3. Train Imitation Model

Train a neural network to map human states to robot actions using the recorded data.

python -m learning.imitation

4. Run Robot Controller

Execute the robot controller to perform the trajectory using retargeting and the learned model.

python -m robot.controller

Project Structure

difotrain/
├── capture/           # Modules for webcam capture and MediaPipe processing
├── representation/    # Data structures for Skeleton and Trajectory states
├── storage/          # JSON storage for recorded movements
├── learning/         # PyTorch models for imitation learning
├── robot/            # Robot control interfaces
├── simulation/       # PyBullet simulation environments
└── tests/            # Unit tests and data generators

Architecture

graph LR
    A[Webcam Input] --> B[MediaPipe Pose]
    B --> C[Human Skeleton]
    C --> D[Trajectory Storage]
    D --> E[Imitation Learning]
    E --> F[Robot Controller]
    F --> G[PyBullet Simulation]
    F --> H[Real Robot]

Workflow

sequenceDiagram
    participant User
    participant Capture
    participant Learning
    participant Robot
    
    User->>Capture: Record Motion
    Capture->>Capture: Process with MediaPipe
    Capture->>Learning: Save Trajectory
    User->>Learning: Train Model
    Learning->>Learning: Map Human to Robot
    User->>Robot: Execute Movement
    Robot->>Robot: Apply Learned Mapping

Technologies

  • MediaPipe: Human pose estimation and landmark detection
  • PyTorch: Neural network training and inference
  • OpenCV: Video capture and image processing
  • PyBullet: Physics simulation and robot control
  • NumPy: Numerical computing and array operations

Contributing

Contributions are welcome. Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Google MediaPipe team for the pose estimation models
  • PyBullet community for the simulation framework
  • PyTorch team for the deep learning framework

Made with dedication to advancing human-robot interaction

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

difotrain-0.1.1.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

difotrain-0.1.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file difotrain-0.1.1.tar.gz.

File metadata

  • Download URL: difotrain-0.1.1.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for difotrain-0.1.1.tar.gz
Algorithm Hash digest
SHA256 da4d20ac34aaaaf31e97e063646ae2dc9d07b9a8b4f70dd435a975f35a5b0c6d
MD5 abb6fdadc1090f19329146f5adb0db74
BLAKE2b-256 954f1ebb9afea00b07aac2a1214e70d05e1c158243a6d52987da37a2fc2ec519

See more details on using hashes here.

File details

Details for the file difotrain-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: difotrain-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for difotrain-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 853e0f3a79ccb521d5bb0f8bdbdab6c2d32e8f231e6bd5027579f10066ea6f2c
MD5 31d6e44da8ab2faa0a5b7afd6f95903d
BLAKE2b-256 125e28a8038d055ad0f90bb42030169250bd714c3c54e715bf9d9e68ceece6cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page