Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mujoco-ulf

MuJoCo (Multi-Joint dynamics with Contact) physics-based simulation for micro-LF on POSIX platforms (Linux and macOS).

This package includes two interactive demos:

  • Basic: a rectangular object that starts above a plane and falls onto it
  • Car: a simple two-wheeled vehicle that can be driven with the arrow keys

Prerequisites

  • A C compiler (GCC or Clang)
  • CMake ≥ 3.20
  • reactor-uc, with REACTOR_UC_PATH pointing at the clone:
git clone https://github.com/lf-lang/reactor-uc.git --recurse-submodules
export REACTOR_UC_PATH=$(pwd)/reactor-uc

GLFW

Linux (Ubuntu):

apt install libglfw3-dev

macOS:

brew install glfw

MuJoCo

CMake looks for MuJoCo in this order:

  1. A CMake package (find_package(mujoco)), for example an install under /usr/local
  2. The official MuJoCo.app bundle on macOS (/Applications/MuJoCo.app)
  3. A prefix layout under /opt/mujoco or /usr/local

Linux (Ubuntu): download a prebuilt release and install it to /opt/mujoco. The following is for x86_64; for aarch64, use the matching archive from https://github.com/google-deepmind/mujoco/releases:

wget https://github.com/google-deepmind/mujoco/releases/download/3.2.7/mujoco-3.2.7-linux-x86_64.tar.gz
tar xvf mujoco-*
sudo mv mujoco-3.2.7 /opt/mujoco

macOS: either install the official app bundle, or build from source and install to /opt/mujoco (or /usr/local):

git clone https://github.com/google-deepmind/mujoco.git -b 3.2.7
cd mujoco
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=/opt/mujoco
cmake --build build
sudo cmake --install build

If MuJoCo is installed somewhere else, pass that prefix to CMake (-DCMAKE_PREFIX_PATH=... or -DMUJOCO_PATH=...).

Building the demos

From the root of this repository, configure and build with the release preset. This generates code for both programs and produces build/Basic and build/Car:

cmake --preset release
cmake --build --preset release

In VS Code or Cursor, CMake: Configure generates the code, and CMake: Build compiles it.

To build only one program:

cmake --preset release -DLF_MAIN=Basic
cmake --build --preset release

Replace Basic with Car for the car demo. A debug build is available with the debug preset (build-debug/ instead of build/).

Running the demos

./build/Basic
./build/Car

Both demos open a visualization window. Mouse scroll zooms, left-drag rotates the view, and right-drag pans. Backspace resets the simulation; q quits.

In Car, the arrow keys set forward speed and steering.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages