Python wrapper for building and controlling MuJoCo physics simulations.
Project description
mojo-mujoco-wrapper
mojo-mujoco-wrapper is a Python library that wraps MuJoCo with a simple object-oriented API. You create and control simulation elements (bodies, geoms, joints, cameras, lights) as Python objects instead of working with MuJoCo's low-level arrays directly. The library handles model construction, recompilation, and physics stepping so you can focus on building scenes and controllers.
Installation
pip install mojo-mujoco-wrapper
Usage
Basic scene
from mojo import Mojo
from mojo.elements import Body, Geom, Joint
from mojo.elements.consts import JointType
mojo = Mojo("world.xml")
# Create a body with a box geom and a hinge joint
body = Body.create(mojo, position=[0, 0, 1])
geom = Geom.create(mojo, parent=body)
joint = Joint.create(mojo, parent=body, joint_type=JointType.HINGE)
# Step the simulation
for _ in range(100):
mojo.step()
print(body.get_position())
Camera
from mojo.elements import Camera
import numpy as np
camera = Camera.create(mojo, position=[0, -2, 1])
camera.set_fovy(60.0)
camera.set_quaternion(np.array([1, 0, 0, 0]))
Kinematic bodies
body = Body.create(mojo, position=[0, 0, 0.5])
Geom.create(mojo, parent=body)
body.set_kinematic(True) # body moves with set_position, ignores physics forces
body.set_position([1, 0, 0.5])
mojo.step()
Getting elements by name
body = Body.get(mojo, name="my_body")
camera = Camera.get(mojo, name="top_cam")
Development
Setup
git clone https://github.com/stepjam/mojo
cd mojo
pip install -e ".[dev]"
Running tests
pytest tests/
Contributing
- Fork the repo and create a branch off
main. - Add tests for any new elements or behavior.
- Open a pull request against
main.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mojo_mujoco_wrapper-0.1.1.tar.gz.
File metadata
- Download URL: mojo_mujoco_wrapper-0.1.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef03de6842b42b62ea656adc8b505d01fdbb2baae698e12be4e90ca09bac0a2e
|
|
| MD5 |
41423cad1894e8fbb9e6a3464a4fc31c
|
|
| BLAKE2b-256 |
fbc0f40a941d287daaa66b69e9f39412b0391c9be1105da9d6f7fb05cc23f093
|
File details
Details for the file mojo_mujoco_wrapper-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mojo_mujoco_wrapper-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb4f3abca0dd2259854afb2c5a637b42898b3086ef4276d7db02baed3d1130b3
|
|
| MD5 |
7507d32f36d995ce80021f9a01e275f2
|
|
| BLAKE2b-256 |
53498bfc2ecb4d9a5d91832178d886e8a309fe5fc16ac7c40df2062d1b48b940
|