Skip to main content

Robotics-AI Training in Hyperrealistic Game Environments

Project description

Default_Logo_Horizontal@2x

Infinite synthetic data generation for embodied AI

PyPI version Documentation License: MIT Python Version Status Discord

https://github.com/user-attachments/assets/0ab2953d-b188-4af7-a225-71decdd2378c

Lucky Robots

Hyperrealistic robotics simulation framework with Python API for embodied AI training and testing.

Bedroom environment in LuckyEngine Open floor plan in LuckyEngine

Quick Start

  1. Download LuckyEngine from our releases page and set the path:

    # Set environment variable (choose one method):
    
    # Method 1: Set LUCKYENGINE_PATH directly to the executable
    export LUCKYENGINE_PATH=/path/to/LuckyEngine      # Linux/Mac
    export LUCKYENGINE_PATH=/path/to/LuckyEngine.exe  # Windows
    
    # Method 2: Set LUCKYENGINE_HOME to the directory containing the executable
    export LUCKYENGINE_HOME=/path/to/luckyengine/directory
    
  2. Install

    pip install luckyrobots
    
  3. Run Example

    git clone https://github.com/luckyrobots/luckyrobots.git
    cd luckyrobots/examples
    python controller.py --skip-launch  # If LuckyEngine is already running
    

Basic Usage

from luckyrobots import LuckyEngineClient

# Connect to LuckyEngine
client = LuckyEngineClient(
    host="127.0.0.1",
    port=50051,
    robot_name="unitreego1",
)
client.wait_for_server()

# Optional: Fetch schema for named observation access
client.fetch_schema()

# Get RL observation
obs = client.get_observation()
print(f"Observation: {obs.observation[:5]}...")  # Flat vector for RL
print(f"Timestamp: {obs.timestamp_ms}")

# Named access (if schema fetched)
# obs["proj_grav_x"]  # Access by name
# obs.to_dict()       # Convert to dict

# Send controls
client.send_control(controls=[0.1, 0.2, -0.1, ...])

# Get joint state (separate from RL observation)
joints = client.get_joint_state()
print(f"Positions: {joints.positions}")
print(f"Velocities: {joints.velocities}")

API Overview

Core Classes

LuckyEngineClient - Low-level gRPC client

  • wait_for_server(timeout) - Wait for LuckyEngine connection
  • get_observation() - Get RL observation vector
  • get_joint_state() - Get joint positions/velocities
  • send_control(controls) - Send actuator commands
  • get_agent_schema() - Get observation/action names and sizes
  • reset_agent() - Reset agent state

LuckyRobots - High-level wrapper (launches LuckyEngine)

  • start(scene, robot, task) - Launch and connect
  • get_observation() - Get observation
  • step(controls) - Send controls and get next observation

Models

from luckyrobots import ObservationResponse, StateSnapshot

# ObservationResponse - returned by get_observation()
obs.observation      # List[float] - flat RL observation vector
obs.actions          # List[float] - last applied actions
obs.timestamp_ms     # int - wall-clock timestamp
obs.frame_number     # int - monotonic counter
obs["name"]          # Named access (if schema fetched)
obs.to_dict()        # Convert to name->value dict

Available Robots & Environments

Robots

  • unitreego1: Quadruped robot
  • so100: 6-DOF manipulator with gripper
  • stretch_v1: Mobile manipulator

Scenes

  • velocity: Velocity control training
  • kitchen: Residential kitchen environment

Tasks

  • locomotion: Walking/movement
  • pickandplace: Object manipulation

Development

Setup with uv (recommended)

# Clone and enter repo
git clone https://github.com/luckyrobots/luckyrobots.git
cd luckyrobots

# Install uv if you haven't
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create venv and install deps
uv sync

# Run tests
uv run pytest

# Run example
uv run python examples/controller.py --skip-launch

Setup with pip

git clone https://github.com/luckyrobots/luckyrobots.git
cd luckyrobots
pip install -e ".[dev]"

Regenerating gRPC Stubs

The Python gRPC stubs are in src/luckyrobots/grpc/generated/ and are generated from protos in src/luckyrobots/grpc/proto/.

python -m grpc_tools.protoc \
  -I "src/luckyrobots/grpc/proto" \
  --python_out="src/luckyrobots/grpc/generated" \
  --grpc_python_out="src/luckyrobots/grpc/generated" \
  src/luckyrobots/grpc/proto/*.proto

Project Structure

src/luckyrobots/
├── client.py            # LuckyEngineClient (main API)
├── luckyrobots.py       # LuckyRobots high-level wrapper
├── models/              # Pydantic models
│   ├── observation.py   # ObservationResponse, StateSnapshot
│   └── camera.py        # CameraData, CameraShape
├── engine/              # Engine management
├── grpc/                # gRPC internals
│   ├── generated/       # Protobuf stubs
│   └── proto/           # .proto files
└── config/              # Robot configurations

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes and add tests
  4. Run uv run ruff check . and uv run ruff format .
  5. Submit a pull request

Architecture

Lucky Robots uses gRPC for communication:

  • LuckyEngine: Physics + rendering backend (Unreal Engine + MuJoCo)
  • Python client: Connects via gRPC (default 127.0.0.1:50051)

gRPC Services

Service Status Description
MujocoService ✅ Working Joint state, controls
AgentService ✅ Working Observations, reset
SceneService 🚧 Placeholder Scene inspection
TelemetryService 🚧 Placeholder Telemetry streaming
CameraService 🚧 Placeholder Camera frames
ViewportService 🚧 Placeholder Viewport pixels

License

MIT License - see LICENSE file.

Support

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

luckyrobots-0.1.72.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

luckyrobots-0.1.72-py3-none-any.whl (63.7 kB view details)

Uploaded Python 3

File details

Details for the file luckyrobots-0.1.72.tar.gz.

File metadata

  • Download URL: luckyrobots-0.1.72.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.24

File hashes

Hashes for luckyrobots-0.1.72.tar.gz
Algorithm Hash digest
SHA256 9cd3bf4e2800693bab100c72c5a626b753325d73c5017aa658cdb24ab8d089ea
MD5 bd2d27eaed12920463639fe1de368f7d
BLAKE2b-256 e3085c5728955d88d338bf3e0c690f2c5aa11adbe186ce82f9c4dd1d404adffc

See more details on using hashes here.

File details

Details for the file luckyrobots-0.1.72-py3-none-any.whl.

File metadata

File hashes

Hashes for luckyrobots-0.1.72-py3-none-any.whl
Algorithm Hash digest
SHA256 cf2a4bb529b487abe4510242ae41d3e8d1aacd0789be130de9b66de7ebc8509e
MD5 5e0422e6469a2b210b42be06f219429c
BLAKE2b-256 1873b5b99fb7a9125dde040726eef57245becf5a7d68c6b6b5642187e8272562

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