Skip to content

Commit

Permalink
update python install
Browse files Browse the repository at this point in the history
  • Loading branch information
thowell committed Mar 3, 2024
1 parent 0f60b51 commit 9901faa
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Google DeepMind.
MJPC allows the user to easily author and solve complex robotics tasks, and
currently supports multiple shooting-based planners. Derivative-based methods include iLQG and
Gradient Descent, while derivative-free methods include a simple yet very competitive planner
called Predictive Sampling and the Cross Entropy Method (with diagonal covariance).
called Predictive Sampling.

- [Overview](#overview)
- [Graphical User Interface](#graphical-user-interface)
Expand Down Expand Up @@ -96,38 +96,39 @@ sudo apt-get install libgl1-mesa-dev libxinerama-dev libxcursor-dev libxrandr-de

### Build Issues
If you encounter build issues, please see the
[Github Actions configuration](https://github.com/google-deepmind/mujoco_mpc/blob/main/.github/workflows/build.yml).
Note, we are using `clang-14`.
[Github Actions configuration](https://github.com/google-deepmind/mujoco_mpc/blob/main/.github/workflows/build.yml).
This provides the exact setup we use for building MJPC for testing.

We recommend building with `clang` and not `gcc`.

# Python API

We provide a simple Python API for MJPC. This API is still experimental and expects some more experience from its users. For example, the correct usage requires that the model (defined in Python) and the MJPC task (i.e., the residual and transition functions defined in C++) are compatible with each other. Currently, the Python API does not provide any particular error handling for verifying this compatibility and may be difficult to debug without more in-depth knowledge about mujoco and MJPC.

- [agent.py](python/mujoco_mpc/agent.py) for available methods for planning.

- [filter.py](python/mujoco_mpc/filter.py) for available methods for state estimation.
## Installing via Pip
First, build MJPC (see above).

- [direct.py](python/mujoco_mpc/direct.py) for available methods for direct optimization.
Next, change to the python directory:
```sh
cd python
```

## Installing via Pip
First, build MJPC (see above), then the MJPC Python module can be installed with:
Install the Python module:
```sh
python "${MUJOCO_MPC_ROOT}/python/${API}.py" install
python setup.py install
```

Test that installation was successful:
```sh
python "${MUJOCO_MPC_ROOT}/python/mujoco_mpc/${API_TEST}.py"
python "mujoco_mpc/agent_test.py"
```

where API(_TEST) can be: agent(_test), filter(_test), or direct(_test). Additionally, the [Python version of MuJoCo](https://pypi.org/project/mujoco/#history) must match the MJPC version (this information can be found in the terminal while the application is running).
Additionally, the [Python version of MuJoCo](https://pypi.org/project/mujoco/#history) should match the MJPC version (this information can be found in the terminal while the application is running).


## Example Usage
See [cartpole.py](python/mujoco_mpc/demos/agent/cartpole.py) for example usage for planning.

See [cartpole_trajopt.py](python/mujoco_mpc/demos/direct/cartpole_trajopt.py) for usage for direct optimization.

## Predictive Control

See the [Predictive Control](docs/OVERVIEW.md) documentation for more
Expand Down

0 comments on commit 9901faa

Please sign in to comment.