Live demo
Click inside the canvas to set a reach target. A GRU policy trained in PyTorch drives the point-mass muscles to reach it โ running here in plain JavaScript. Open the demo full-screen โ
What it does
Effectors & muscles
Point masses and two-joint arms driven by Hill-type, Thelen, MuJoCo, and ReLU muscle models โ the same biomechanics as the Python toolbox.
Gym-style environments
A RandomTargetReach environment with the familiar
reset / step / obs / reward loop for closed-loop control.
Run trained policies
Export a PolicyGRU from PyTorch and run inference in the browser โ
no Python, no server, no WebAssembly.
Numerically validated
Trajectories are checked against the PyTorch reference across seven effector/muscle configurations plus the GRU policy.
Quick start
import { RigidTendonArm26, RigidTendonHillMuscle } from 'motornetjs';
const effector = new RigidTendonArm26({ muscle: new RigidTendonHillMuscle() });
effector.reset({ jointState: [0.5, 1.0] }); // shoulder, elbow (radians)
const action = [0.3, 0.0, 0.6, 0.0, 0.2, 0.1]; // 6 muscle excitations in [0,1]
for (let t = 0; t < 50; t++) effector.step(action);
console.log(effector.states.fingertip); // [x, y] endpoint position
See the README for environments, trained-policy inference, and the full API.