0.0.1 • Published 3 years ago

@cwiz89/mujoco-wasm v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

MuJoCo-WASM

MuJoCo built with emscripten for use in JavaScript and WebAssembly. This includes MuJoCo 2.3.1 built as static library and a simple example application.

Usage

1. Install emscripten

2. Build MuJoCo-WASM application

mkdir build
cd build
emcmake cmake ..
make

JavaScript API

Model

methoddescription
load_from_xmlLoad model from xml string
ptrGet pointer to MuJoCo model
valGet MuJoCo model value
namesGet names of model
mesh_vertadrGet mesh vertex address
mesh_vertnumGet mesh vertex number
mesh_faceadrGet mesh face address
mesh_facenumGet mesh face number
body_parentidGet body parent id
body_geomnumGet body geometry number
body_geomadrGet body geometry address
geom_typeGet geometry type
geom_bodyidGet geometry body id
geom_groupGet geometry group
geom_contypeGet geometry contact type
mesh_normalGet mesh normal
mesh_faceGet mesh face
mesh_vertGet mesh vertex
name_meshadrGet name mesh address
geom_posGet geometry position
geom_quatGet geometry quaternion
geom_sizeGet geometry size
geom_rgbaGet geometry rgba
body_posGet body position
body_quatGet body quaternion

State

methoddescription
ptrGet pointer to MuJoCo state
valGet MuJoCo state value

Simulation

methoddescription
stepStep simulation
stateGet simulation state
modelGet simulation model
xquatGet quaternion
xposGet position
xmatGet matrix