Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ethanabrooks/mujoco

Python wrapper for MuJoCo physics simulation.
https://github.com/ethanabrooks/mujoco

mujoco physics-simulation python-wrapper

Last synced: 1 day ago
JSON representation

Python wrapper for MuJoCo physics simulation.

Awesome Lists containing this project

README

        

.. inclusion-marker-do-not-remove

MuJoCo for Python!
==================

This is a simple python wrapper around the MuJoCo physics simulation. I wrote it when I couldn't fix the `GLEW initialization error `_ with `mujoco-py `_. Please note: this library is a partial replacement (not a supplement) to
``mujoco-py``. It is does not have all of the features of ``mujoco-py`` but it is much simpler and easier to understand. If there are additional capabilities you want added, please feel free to
`post an issue `_.

Installation
------------

OS X
~~~~

.. code-block:: bash

pip install mujoco

Linux
~~~~~
Building ``pypi`` wheels for linux packages that use C extensions (like this one) is very difficult (nay impossible?). Please install from source:

.. code-block:: bash

cd /path/to/cloned/directory
make
pip install -e .

Usage
-----
Examples are located in the ``examples/`` directory.

EGL
---
`EGL `_ is a graphics library for linux GPUs which speeds up offscreen rendering. First, you need to install ``libegl1-mesa`` and check that ``/usr/include/EGL/egl.h`` exists. Second, you must define the environment variable ``EGL=1``. Otherwise, the code defaults to GLFW. Note that when using EGL, you cannot render to the screen (you can still render offscreen).

Headless Rendering
------------------
GLFW does not currently support headless rendering (usually this means rendering on a remote server without an attached display).
Instead you must use EGL (if you are on an NVIDIA GPU) or OSMesa otherwise.
To ensure that the proper libraries are built and imported, set ``headless: True`` in your ``config.yml``.

Design
------
One of the main design decisions behind this implementation was to use the exact same libraries that Emo's original MuJoCo code uses in the provided Makefile. That way if my version doesn't work, you can bet that Emo's code doesn't work either. I think the reason why ``mujoco-py`` stopped working is that it tried to get fancy with the libraries and dynamically switch between EGL- and GLFW-friendly graphics libraries.

Documentation
-------------
Sadly, I haven't been able to load my docs to readthedocs.org yet, because of difficulties over importing the original MuJoCo headers on their servers (suggestions welcome). However, if you wish to build the docs yourself, the following commands should do it for you:

.. code-block:: bash

cd /path/to/cloned/directory
make
cd docs/
make html