Difference between revisions of "MuJoCo WASM"

From Humanoid Robots Wiki
Jump to: navigation, search
(Add install process)
(emscripten instructions)
Line 3: Line 3:
 
=== 1. Install emscripten ===
 
=== 1. Install emscripten ===
 
First, you need to install emscripten, which is a compiler toolchain for WebAssembly.
 
First, you need to install emscripten, which is a compiler toolchain for WebAssembly.
 +
 +
 +
=== 1. Get the emsdk repo ===
 +
<code>
 +
git clone https://github.com/emscripten-core/emsdk.git
 +
</code>
 +
 +
=== 2. Enter that directory ===
 +
<code>
 +
cd emsdk
 +
</code>
 +
 +
=== 3. Download and install the latest SDK tools ===
 +
<code>
 +
./emsdk install latest
 +
</code>
 +
 +
=== 4. Make the "latest" SDK "active" ===
 +
<code>
 +
./emsdk activate latest
 +
</code>
 +
 +
=== 5. Activate PATH and other environment variables ===
 +
<code>
 +
source ./emsdk_env.sh
 +
</code>
 +
 +
These variables are set for the current terminal. If you want to make it for all terminals, you can add them to any terminal profile. Here they are:
 +
 +
The environment variables:
 +
 +
<code>
 +
EMSDK = < path to emsdk dir >
 +
 +
EM_CONFIG = ~/.emscripten
 +
 +
EMSDK_NODE = < path to emsdk dir >/node/12.9.1_64bit/bin/node
 +
</code>
 +
 +
=== 6. Now just try it! ===
 +
<code>
 +
emcc
 +
</code>
 +
  
 
=== 2. Build the mujoco_wasm Binary ===
 
=== 2. Build the mujoco_wasm Binary ===

Revision as of 19:15, 19 May 2024

Building

1. Install emscripten

First, you need to install emscripten, which is a compiler toolchain for WebAssembly.


1. Get the emsdk repo

git clone https://github.com/emscripten-core/emsdk.git

2. Enter that directory

cd emsdk

3. Download and install the latest SDK tools

./emsdk install latest

4. Make the "latest" SDK "active"

./emsdk activate latest

5. Activate PATH and other environment variables

source ./emsdk_env.sh

These variables are set for the current terminal. If you want to make it for all terminals, you can add them to any terminal profile. Here they are:

The environment variables:

EMSDK = < path to emsdk dir >

EM_CONFIG = ~/.emscripten

EMSDK_NODE = < path to emsdk dir >/node/12.9.1_64bit/bin/node

6. Now just try it!

emcc


2. Build the mujoco_wasm Binary

Next, you'll build the MuJoCo WebAssembly binary.

On Linux

mkdir build cd build emcmake cmake .. make