Caltech-AMBER / ambersim

In-house tools built on GPU-accelerated simulation
MIT License
7 stars 2 forks source link

AMBER Simulation Tools

This repository houses tools built on the GPU-accelerated simulation capabilities of MuJoCo 3. The goal is to act as a centralized location for

Installation

Local

Clone this repository and run the following commands in the repository root to create and activate a conda environment with Cuda 11.8 support:

conda env create -n <env_name> -f environment.yml
conda activate <env_name>

TL;DR: installation commands are here. This will ask you for your password to install system-wide dependencies. For details, see below.

For non-developers installing mujoco from source, run the following in the repo root:

./ambersim/_scripts/install.sh -s

For developers installing mujoco from source:

# no path to the mujoco repo specified
./ambersim/_scripts/install.sh -s -d

# specifying a path to the mujoco repo
./ambersim/_scripts/install.sh -s -d --mujoco-dir /path/ending/in/mujoco

Installation of this package is done via the above bash script. There are a few flags for configuring the installation:

If the following line of code runs without error, then the installation of mujoco from source was successful:

python -c "import mujoco; from mujoco import mjx"

Further, you can examine the latest minor version using pip:

pip show mujoco
pip show mujoco-mjx

Via pip

There's currently no official pypi release, but you can still install this package via pip. We recommend installing it in a conda environment with Cuda 11.8 support.

# all development dependencies
pip install "ambersim[all] @ git+https://github.com/Caltech-AMBER/ambersim.git" --find-links https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

# barebones dependencies
pip install "ambersim @ git+https://github.com/Caltech-AMBER/ambersim.git" --find-links https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

This package also installs a script that can help you optionally build and install mujoco from source to get the latest and greatest features and bugfixes between official releases.

install-mujoco-from-src [--hash <mujoco_commit_hash>] [--mujoco-dir /path/to/local/mujoco]

Both --hash and --mujoco-dir are optional arguments. If no hash is supplied, we pull the latest one. If no mujoco directory is supplied, we clone mujoco into $HOME/mujoco. We recommend pointing this to a reasonable location instead of using the default.

In order to build mujoco successfully, you may need to install system-wide dependencies with the following commands:

sudo apt-get update
sudo apt-get install -y \
    libgl1-mesa-dev \
    libxinerama-dev \
    libxcursor-dev \
    libxrandr-dev \
    libxi-dev \
    ninja-build

Custom Models

We have implemented some custom utils for model parsing, but they aren't complete/perfect. Here are some guidelines for when you want to use this codebase for a custom project:

Development Details

Abridged Dev Guidelines

Development on this code will be controlled via code review. To facilitate this, please follow these guidelines:

Dependencies

Python dependencies are specified using a pyproject.toml file. Non-python dependencies are specified using the environment.yml file, which can create a compliant conda environment.

Major versioning decisions:

Tooling

We use various tools to ensure code quality.

Tooling Support
Style flake8
Formatting black
Imports isort
Tests pytest
Type Checking pyright

We follow Google code style conventions (in particular, for docstrings).

Dev Contact

In alphabetical order, the members of the lab working on this are: