mujoco-react 8.2.1 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -7
- package/dist/index.d.ts +93 -8
- package/dist/index.js +484 -87
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/ContactMarkers.tsx +14 -12
- package/src/components/Debug.tsx +18 -16
- package/src/components/FlexRenderer.tsx +1 -1
- package/src/components/TendonRenderer.tsx +1 -1
- package/src/core/GenericIK.ts +13 -10
- package/src/core/MujocoProvider.tsx +93 -8
- package/src/core/MujocoSimProvider.tsx +63 -18
- package/src/core/SceneLoader.ts +354 -2
- package/src/hooks/useContacts.ts +20 -18
- package/src/hooks/useIkController.ts +30 -11
- package/src/index.ts +10 -0
- package/src/rendering/GeomBuilder.ts +1 -1
- package/src/types.ts +94 -7
- package/src/wasm-url.d.ts +4 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> **Beta** — This library is under active development. The API may change between minor versions until 10.0.
|
|
8
8
|
|
|
9
|
-
Composable [React Three Fiber](https://docs.pmnd.rs/react-three-fiber) wrapper around [mujoco
|
|
9
|
+
Composable [React Three Fiber](https://docs.pmnd.rs/react-three-fiber) wrapper around the official [@mujoco/mujoco](https://www.npmjs.com/package/@mujoco/mujoco) WASM bindings. Load any MuJoCo model, step physics, render bodies, and write controllers as React components.
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/mujoco-react)
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ const config: SceneConfig = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
function Scene() {
|
|
40
|
-
const ik = useIkController({ siteName: "tcp"
|
|
40
|
+
const ik = useIkController({ siteName: "tcp" });
|
|
41
41
|
return (
|
|
42
42
|
<>
|
|
43
43
|
<OrbitControls enableDamping makeDefault />
|
|
@@ -104,6 +104,91 @@ function useMyController(gain: number) {
|
|
|
104
104
|
}
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
### Applying Forces
|
|
108
|
+
|
|
109
|
+
Write directly to `xfrc_applied` in a physics callback for per-frame forces. The layout is `[torque_x, torque_y, torque_z, force_x, force_y, force_z]` per body:
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { useBeforePhysicsStep } from "mujoco-react";
|
|
113
|
+
|
|
114
|
+
function useSpringForce(bodyId: number, target: [number, number, number], stiffness = 100) {
|
|
115
|
+
useBeforePhysicsStep((_model, data) => {
|
|
116
|
+
const i3 = bodyId * 3;
|
|
117
|
+
const i6 = bodyId * 6;
|
|
118
|
+
data.xfrc_applied[i6 + 3] = (target[0] - data.xpos[i3]) * stiffness;
|
|
119
|
+
data.xfrc_applied[i6 + 4] = (target[1] - data.xpos[i3 + 1]) * stiffness;
|
|
120
|
+
data.xfrc_applied[i6 + 5] = (target[2] - data.xpos[i3 + 2]) * stiffness;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The `api.applyForce(bodyName, force)` convenience method also works for one-off interactions (e.g. button clicks) but does a name lookup each call.
|
|
126
|
+
|
|
127
|
+
### WebSocket Control
|
|
128
|
+
|
|
129
|
+
Stream actuator commands over a WebSocket and send simulation state back. Use a schema validator such as Zod at this boundary because socket messages are untrusted app input (`npm install zod` for this example):
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { useEffect, useRef } from "react";
|
|
133
|
+
import { z } from "zod";
|
|
134
|
+
import { useMujoco, useBeforePhysicsStep, useAfterPhysicsStep } from "mujoco-react";
|
|
135
|
+
|
|
136
|
+
const CtrlCommand = z.object({
|
|
137
|
+
type: z.literal("ctrl_command"),
|
|
138
|
+
ctrl: z.array(z.number()),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
type CtrlCommand = z.infer<typeof CtrlCommand>;
|
|
142
|
+
|
|
143
|
+
function parseSocketMessage(data: string): CtrlCommand | null {
|
|
144
|
+
try {
|
|
145
|
+
const parsed = CtrlCommand.safeParse(JSON.parse(data));
|
|
146
|
+
return parsed.success ? parsed.data : null;
|
|
147
|
+
} catch {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function useWebSocketControls(url: string) {
|
|
153
|
+
const wsRef = useRef<WebSocket | null>(null);
|
|
154
|
+
const latestCommandRef = useRef<CtrlCommand | null>(null);
|
|
155
|
+
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
const ws = new WebSocket(url);
|
|
158
|
+
wsRef.current = ws;
|
|
159
|
+
|
|
160
|
+
ws.onmessage = (evt) => {
|
|
161
|
+
latestCommandRef.current = parseSocketMessage(evt.data);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return () => ws.close();
|
|
165
|
+
}, [url]);
|
|
166
|
+
|
|
167
|
+
// Apply incoming actuator controls each physics step.
|
|
168
|
+
useBeforePhysicsStep((model, data) => {
|
|
169
|
+
const command = latestCommandRef.current;
|
|
170
|
+
if (!command) return;
|
|
171
|
+
for (let i = 0; i < Math.min(command.ctrl.length, model.nu); i++) {
|
|
172
|
+
data.ctrl[i] = command.ctrl[i];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Send simulation feedback back after physics.
|
|
177
|
+
useAfterPhysicsStep((model, data) => {
|
|
178
|
+
const ws = wsRef.current;
|
|
179
|
+
if (!ws || ws.readyState !== WebSocket.OPEN) return;
|
|
180
|
+
|
|
181
|
+
ws.send(JSON.stringify({
|
|
182
|
+
type: "feedback",
|
|
183
|
+
time: data.time,
|
|
184
|
+
qpos: Array.from(data.qpos),
|
|
185
|
+
qvel: Array.from(data.qvel),
|
|
186
|
+
sensordata: Array.from(data.sensordata),
|
|
187
|
+
}));
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
107
192
|
For reusable controllers with typed config, default merging, and children, use the `createController` factory:
|
|
108
193
|
|
|
109
194
|
```tsx
|
|
@@ -155,7 +240,7 @@ const myIK: IKSolveFn = (pos, quat, currentQ) => {
|
|
|
155
240
|
return myAnalyticalSolver(pos, currentQ); // return joint angles or null
|
|
156
241
|
};
|
|
157
242
|
|
|
158
|
-
const ik = useIkController({ siteName: "tcp",
|
|
243
|
+
const ik = useIkController({ siteName: "tcp", ikSolveFn: myIK });
|
|
159
244
|
```
|
|
160
245
|
|
|
161
246
|
### `useIkController(config | null)`
|
|
@@ -163,14 +248,16 @@ const ik = useIkController({ siteName: "tcp", numJoints: 7, ikSolveFn: myIK });
|
|
|
163
248
|
Hook for interactive end-effector control. Pass `null` to disable IK (safe to call unconditionally):
|
|
164
249
|
|
|
165
250
|
```tsx
|
|
166
|
-
const ik = useIkController({ siteName: "tcp"
|
|
251
|
+
const ik = useIkController({ siteName: "tcp" });
|
|
167
252
|
return ik ? <IkGizmo controller={ik} /> : null;
|
|
168
253
|
```
|
|
169
254
|
|
|
170
255
|
| Config | Type | Default | Description |
|
|
171
256
|
|--------|------|---------|-------------|
|
|
172
257
|
| `siteName` | `string` | **required** | MuJoCo site to track |
|
|
173
|
-
| `
|
|
258
|
+
| `joints` | `string \| string[] \| RegExp \| (joint) => boolean` | inferred | Explicit hinge/slide joints for IK |
|
|
259
|
+
| `actuators` | `string \| string[] \| RegExp \| (actuator) => boolean` | inferred | Explicit actuators for IK output |
|
|
260
|
+
| `numJoints` | `number` | legacy only | Contiguous qpos/ctrl count from older examples |
|
|
174
261
|
| `ikSolveFn` | `IKSolveFn` | built-in DLS | Custom solver function |
|
|
175
262
|
| `damping` | `number` | `0.01` | DLS damping |
|
|
176
263
|
| `maxIterations` | `number` | `50` | Max solver iterations |
|
|
@@ -179,6 +266,20 @@ Returns `IkContextValue | null` with methods like `setIkEnabled`, `moveTarget`,
|
|
|
179
266
|
|
|
180
267
|
Pass the returned value to `<IkGizmo controller={ik} />` or to your own controller as a prop.
|
|
181
268
|
|
|
269
|
+
By default the controller infers scalar hinge/slide joints by walking from the site body toward the model root. For robots where the MJCF control layout is not a simple chain, pass explicit names:
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
const leftArmIk = useIkController({
|
|
273
|
+
siteName: "left_tcp",
|
|
274
|
+
joints: ["left_shoulder", "left_elbow", "left_wrist"],
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const gripperIk = useIkController({
|
|
278
|
+
siteName: "tcp",
|
|
279
|
+
actuators: /^actuator/,
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
182
283
|
## Type-Safe Resource Names
|
|
183
284
|
|
|
184
285
|
Use TypeScript module augmentation to get autocomplete and type checking for actuator, sensor, body, joint, site, geom, and keyframe names:
|
|
@@ -262,8 +363,29 @@ Loads the MuJoCo WASM module. Wrap your entire app in this.
|
|
|
262
363
|
| Prop | Type | Description |
|
|
263
364
|
|------|------|-------------|
|
|
264
365
|
| `wasmUrl` | `string?` | Custom WASM URL override |
|
|
366
|
+
| `mtWasmUrl` | `string?` | Custom multi-threaded WASM URL override |
|
|
367
|
+
| `threadedLoader` | `(options?) => Promise<unknown>` | Optional loader imported from `@mujoco/mujoco/mt` |
|
|
368
|
+
| `wasmVariant` | `"single" \| "threaded" \| "auto"` | MuJoCo WASM build. Defaults to `"single"` |
|
|
369
|
+
| `timeout` | `number` | WASM load timeout in ms |
|
|
265
370
|
| `onError` | `(error: Error) => void` | Called if WASM fails to load |
|
|
266
371
|
|
|
372
|
+
The official `@mujoco/mujoco` package also ships a multi-threaded WASM build. Import it only in apps that opt into it:
|
|
373
|
+
|
|
374
|
+
```tsx
|
|
375
|
+
import loadMujocoMt from "@mujoco/mujoco/mt";
|
|
376
|
+
import mtWasmUrl from "@mujoco/mujoco/mt/mujoco.wasm?url";
|
|
377
|
+
|
|
378
|
+
<MujocoProvider
|
|
379
|
+
wasmVariant="auto"
|
|
380
|
+
threadedLoader={loadMujocoMt}
|
|
381
|
+
mtWasmUrl={mtWasmUrl}
|
|
382
|
+
>
|
|
383
|
+
<App />
|
|
384
|
+
</MujocoProvider>
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
`"auto"` uses the threaded build only when `threadedLoader` and `mtWasmUrl` are provided and `globalThis.crossOriginIsolated` is true. Forced `"threaded"` mode requires `threadedLoader`, `mtWasmUrl`, `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp`.
|
|
388
|
+
|
|
267
389
|
### `<MujocoCanvas>`
|
|
268
390
|
|
|
269
391
|
Thin wrapper around R3F `<Canvas>`. Accepts all R3F Canvas props plus:
|
|
@@ -445,7 +567,7 @@ import { useMujocoWasm } from "mujoco-react";
|
|
|
445
567
|
const { mujoco, status } = useMujocoWasm();
|
|
446
568
|
|
|
447
569
|
if (mujoco) {
|
|
448
|
-
const model = mujoco.MjModel.
|
|
570
|
+
const model = mujoco.MjModel.from_xml_path("/path/to/scene.xml");
|
|
449
571
|
const data = new mujoco.MjData(model);
|
|
450
572
|
mujoco.mj_step(model, data);
|
|
451
573
|
console.log(data.qpos); // joint positions after one step
|
|
@@ -769,7 +891,7 @@ Features planned but not yet implemented:
|
|
|
769
891
|
| **Web Worker physics** | P2 | Run `mj_step` off main thread via SharedArrayBuffer |
|
|
770
892
|
| **Register codegen** | P2 | CLI to auto-generate `Register` type augmentation from MJCF XML |
|
|
771
893
|
|
|
772
|
-
### WASM Limitations (mujoco
|
|
894
|
+
### WASM Limitations (@mujoco/mujoco)
|
|
773
895
|
|
|
774
896
|
These MuJoCo features are not yet exposed in the WASM binding:
|
|
775
897
|
|
package/dist/index.d.ts
CHANGED
|
@@ -64,12 +64,13 @@ interface MujocoContact {
|
|
|
64
64
|
*/
|
|
65
65
|
interface MujocoContactArray {
|
|
66
66
|
get(i: number): MujocoContact | undefined;
|
|
67
|
+
delete?: () => void;
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
|
-
* Read a single contact from
|
|
70
|
+
* Read a single contact from an already-acquired WASM contact array.
|
|
70
71
|
* Returns undefined if the access fails (WASM heap issue, bad index, etc.).
|
|
71
72
|
*/
|
|
72
|
-
declare function getContact(
|
|
73
|
+
declare function getContact(contacts: MujocoContactArray, i: number): MujocoContact | undefined;
|
|
73
74
|
/**
|
|
74
75
|
* Minimal interface for MuJoCo Model to avoid 'any'.
|
|
75
76
|
*/
|
|
@@ -217,7 +218,9 @@ interface MujocoData {
|
|
|
217
218
|
*/
|
|
218
219
|
interface MujocoModule {
|
|
219
220
|
MjModel: {
|
|
220
|
-
|
|
221
|
+
from_xml_path?: (path: string) => MujocoModel;
|
|
222
|
+
from_xml_string?: (xml: string, vfs?: unknown) => MujocoModel;
|
|
223
|
+
loadFromXML?: (path: string) => MujocoModel;
|
|
221
224
|
[key: string]: unknown;
|
|
222
225
|
};
|
|
223
226
|
MjData: new (model: MujocoModel) => MujocoData;
|
|
@@ -282,11 +285,22 @@ interface SceneConfig {
|
|
|
282
285
|
xmlPatches?: XmlPatch[];
|
|
283
286
|
onReset?: (model: MujocoModel, data: MujocoData) => void;
|
|
284
287
|
}
|
|
288
|
+
type ResourceSelector<TInfo, TName extends string = string> = TName | readonly TName[] | RegExp | ((info: TInfo) => boolean);
|
|
285
289
|
interface IkConfig {
|
|
286
290
|
/** MuJoCo site name for IK target. */
|
|
287
291
|
siteName: Sites;
|
|
288
|
-
/**
|
|
289
|
-
|
|
292
|
+
/**
|
|
293
|
+
* Explicit joints for IK. When omitted, the controller infers scalar hinge/slide
|
|
294
|
+
* joints by walking from the site body to the model root.
|
|
295
|
+
*/
|
|
296
|
+
joints?: ResourceSelector<JointInfo, Joints>;
|
|
297
|
+
/** Explicit actuators for IK control output. */
|
|
298
|
+
actuators?: ResourceSelector<ActuatorInfo, Actuators>;
|
|
299
|
+
/**
|
|
300
|
+
* Number of joints to solve for, assuming legacy contiguous qpos/ctrl layout
|
|
301
|
+
* starting at index 0. Prefer inferred IK or `joints`/`actuators`.
|
|
302
|
+
*/
|
|
303
|
+
numJoints?: number;
|
|
290
304
|
/** Custom IK solver. When omitted, uses built-in Damped Least-Squares solver. */
|
|
291
305
|
ikSolveFn?: IKSolveFn;
|
|
292
306
|
/** DLS damping. Default: 0.01. */
|
|
@@ -320,7 +334,13 @@ interface PhysicsConfig {
|
|
|
320
334
|
paused?: boolean;
|
|
321
335
|
speed?: number;
|
|
322
336
|
}
|
|
323
|
-
type IKSolveFn = (pos: THREE.Vector3, quat: THREE.Quaternion, currentQ: number[]) => number[] | null;
|
|
337
|
+
type IKSolveFn = (pos: THREE.Vector3, quat: THREE.Quaternion, currentQ: number[], context?: IKSolveContext) => number[] | null;
|
|
338
|
+
interface IKSolveContext {
|
|
339
|
+
model: MujocoModel;
|
|
340
|
+
data: MujocoData;
|
|
341
|
+
siteId: number;
|
|
342
|
+
controlGroup: ControlGroupInfo;
|
|
343
|
+
}
|
|
324
344
|
type PhysicsStepCallback = (model: MujocoModel, data: MujocoData) => void;
|
|
325
345
|
interface StateSnapshot {
|
|
326
346
|
time: number;
|
|
@@ -365,6 +385,44 @@ interface ActuatorInfo {
|
|
|
365
385
|
name: string;
|
|
366
386
|
range: [number, number];
|
|
367
387
|
}
|
|
388
|
+
interface ActuatedJointInfo extends JointInfo {
|
|
389
|
+
actuatorId: number;
|
|
390
|
+
actuatorName: string;
|
|
391
|
+
ctrlAdr: number;
|
|
392
|
+
ctrlRange: [number, number];
|
|
393
|
+
}
|
|
394
|
+
interface ControlJointInfo extends JointInfo {
|
|
395
|
+
actuatorId: number | null;
|
|
396
|
+
actuatorName: string | null;
|
|
397
|
+
ctrlAdr: number | null;
|
|
398
|
+
ctrlRange: [number, number] | null;
|
|
399
|
+
}
|
|
400
|
+
interface ControlGroupSelector {
|
|
401
|
+
/** Infer a kinematic chain from a MuJoCo site. */
|
|
402
|
+
siteName?: Sites;
|
|
403
|
+
/** Infer a kinematic chain from a body. */
|
|
404
|
+
bodyName?: Bodies;
|
|
405
|
+
/** Select joints by name, names, regex, or predicate. */
|
|
406
|
+
joints?: ResourceSelector<JointInfo, Joints>;
|
|
407
|
+
/** Select actuators by name, names, regex, or predicate. */
|
|
408
|
+
actuators?: ResourceSelector<ActuatorInfo, Actuators>;
|
|
409
|
+
}
|
|
410
|
+
interface ControlGroupInfo {
|
|
411
|
+
/** Joints in solve/control order. */
|
|
412
|
+
joints: ControlJointInfo[];
|
|
413
|
+
/** Actuators in control output order. */
|
|
414
|
+
actuators: ActuatorInfo[];
|
|
415
|
+
/** qpos addresses for scalar hinge/slide joints. */
|
|
416
|
+
qposAdr: number[];
|
|
417
|
+
/** dof addresses for scalar hinge/slide joints. */
|
|
418
|
+
dofAdr: number[];
|
|
419
|
+
/** ctrl addresses matching writable actuators. */
|
|
420
|
+
ctrlAdr: number[];
|
|
421
|
+
readQpos(data: MujocoData): Float64Array;
|
|
422
|
+
readCtrl(data: MujocoData): Float64Array;
|
|
423
|
+
writeQpos(data: MujocoData, values: ArrayLike<number>): void;
|
|
424
|
+
writeCtrl(data: MujocoData, values: ArrayLike<number>): void;
|
|
425
|
+
}
|
|
368
426
|
interface SensorInfo {
|
|
369
427
|
id: number;
|
|
370
428
|
name: string;
|
|
@@ -492,6 +550,9 @@ interface MujocoSimAPI {
|
|
|
492
550
|
getQvel(): Float64Array;
|
|
493
551
|
setCtrl(nameOrValues: Actuators | Record<Actuators, number>, value?: number): void;
|
|
494
552
|
getCtrl(): Float64Array;
|
|
553
|
+
getControlMap(): ControlGroupInfo;
|
|
554
|
+
getActuatedJoints(): ActuatedJointInfo[];
|
|
555
|
+
resolveControlGroup(selector: ControlGroupSelector): ControlGroupInfo | null;
|
|
495
556
|
applyForce(bodyName: Bodies, force: THREE.Vector3, point?: THREE.Vector3): void;
|
|
496
557
|
applyTorque(bodyName: Bodies, torque: THREE.Vector3): void;
|
|
497
558
|
setExternalForce(bodyName: Bodies, force: THREE.Vector3, torque: THREE.Vector3): void;
|
|
@@ -582,8 +643,28 @@ interface JointStateResult {
|
|
|
582
643
|
* Hook to access the MuJoCo WASM module.
|
|
583
644
|
*/
|
|
584
645
|
declare function useMujocoWasm(): MujocoContextValue;
|
|
646
|
+
type MujocoWasmVariant = 'single' | 'threaded' | 'auto';
|
|
647
|
+
interface MujocoLoaderOptions {
|
|
648
|
+
locateFile?: (path: string) => string;
|
|
649
|
+
printErr?: (text: string) => void;
|
|
650
|
+
}
|
|
651
|
+
type MujocoLoader = (options?: MujocoLoaderOptions) => Promise<unknown>;
|
|
585
652
|
interface MujocoProviderProps {
|
|
586
653
|
wasmUrl?: string;
|
|
654
|
+
/** Optional URL for the multi-threaded WASM asset. */
|
|
655
|
+
mtWasmUrl?: string;
|
|
656
|
+
/**
|
|
657
|
+
* Optional official multi-threaded loader, usually imported from
|
|
658
|
+
* `@mujoco/mujoco/mt`. It is supplied by the app so the default package path
|
|
659
|
+
* does not force every bundler to process the threaded Emscripten build.
|
|
660
|
+
*/
|
|
661
|
+
threadedLoader?: MujocoLoader;
|
|
662
|
+
/**
|
|
663
|
+
* MuJoCo WASM build to load. `single` is the default and works everywhere.
|
|
664
|
+
* `threaded` requires `threadedLoader` and cross-origin isolation. `auto`
|
|
665
|
+
* uses threaded only when both conditions are satisfied.
|
|
666
|
+
*/
|
|
667
|
+
wasmVariant?: MujocoWasmVariant;
|
|
587
668
|
/** Timeout in ms for WASM module load. Default: 30000. */
|
|
588
669
|
timeout?: number;
|
|
589
670
|
children: React.ReactNode;
|
|
@@ -593,7 +674,7 @@ interface MujocoProviderProps {
|
|
|
593
674
|
* MujocoProvider — WASM / module lifecycle.
|
|
594
675
|
* Loads the MuJoCo WASM module on mount and provides it to children via context.
|
|
595
676
|
*/
|
|
596
|
-
declare function MujocoProvider({ wasmUrl, timeout, children, onError }: MujocoProviderProps): react_jsx_runtime.JSX.Element;
|
|
677
|
+
declare function MujocoProvider({ wasmUrl, mtWasmUrl, threadedLoader, wasmVariant, timeout, children, onError, }: MujocoProviderProps): react_jsx_runtime.JSX.Element;
|
|
597
678
|
|
|
598
679
|
/**
|
|
599
680
|
* MujocoCanvas — thin R3F Canvas wrapper for MuJoCo scenes.
|
|
@@ -737,6 +818,10 @@ declare function findSensorByName(mjModel: MujocoModel, name: string): number;
|
|
|
737
818
|
* Find a tendon by name in the MuJoCo model. Returns -1 if not found.
|
|
738
819
|
*/
|
|
739
820
|
declare function findTendonByName(mjModel: MujocoModel, name: string): number;
|
|
821
|
+
declare function getActuatedJoints(mjModel: MujocoModel): ActuatedJointInfo[];
|
|
822
|
+
declare function getControlMap(mjModel: MujocoModel): ControlGroupInfo;
|
|
823
|
+
declare function resolveControlGroup(mjModel: MujocoModel, selector: ControlGroupSelector): ControlGroupInfo | null;
|
|
824
|
+
declare function createContiguousControlGroup(mjModel: MujocoModel, count: number): ControlGroupInfo;
|
|
740
825
|
interface LoadResult {
|
|
741
826
|
mjModel: MujocoModel;
|
|
742
827
|
mjData: MujocoData;
|
|
@@ -1301,4 +1386,4 @@ interface CameraAnimationAPI {
|
|
|
1301
1386
|
*/
|
|
1302
1387
|
declare function useCameraAnimation(): CameraAnimationAPI;
|
|
1303
1388
|
|
|
1304
|
-
export { type ActuatorInfo, type Actuators, type Bodies, Body, type BodyInfo, type BodyProps, type BodyStateResult, type CameraAnimationAPI, type ContactInfo, ContactListener, type ContactListenerProps, ContactMarkers, type ControllerComponent, type ControllerOptions, type CtrlHandle, Debug, type DebugProps, DragInteraction, type DragInteractionProps, FlexRenderer, type GeomInfo, type Geoms, type IKSolveFn, type IkConfig, type IkContextValue, IkGizmo, type IkGizmoProps, type JointInfo, type JointStateResult, type Joints, type KeyBinding, type KeyboardTeleopConfig, type Keyframes, type ModelOptions, MujocoCanvas, type MujocoCanvasProps, type MujocoContact, type MujocoContactArray, type MujocoContextValue, type MujocoData, type MujocoModel, type MujocoModule, MujocoPhysics, type MujocoPhysicsProps, MujocoProvider, type MujocoSimAPI, MujocoSimProvider, type PhysicsConfig, type PhysicsStepCallback, type PlaybackState, type PolicyConfig, type RayHit, type Register, type SceneConfig, SceneLights, type SceneLightsProps, type SceneMarker, type SceneObject, type SensorHandle, type SensorInfo, type SensorResult, type Sensors, type SiteInfo, type SitePositionResult, type Sites, type StateSnapshot, TendonRenderer, type TrajectoryData, type TrajectoryFrame, type TrajectoryInput, TrajectoryPlayer, type TrajectoryPlayerProps, type XmlPatch, createController, createControllerHook, findActuatorByName, findBodyByName, findGeomByName, findJointByName, findKeyframeByName, findSensorByName, findSiteByName, findTendonByName, getContact, getName, loadScene, useActuators, useAfterPhysicsStep, useBeforePhysicsStep, useBodyMeshes, useBodyState, useCameraAnimation, useContactEvents, useContacts, useCtrl, useCtrlNoise, useGamepad, useGravityCompensation, useIkController, useJointState, useKeyboardTeleop, useMujoco, useMujocoWasm, usePolicy, useSceneLights, useSelectionHighlight, useSensor, useSensors, useSitePosition, useTrajectoryPlayer, useTrajectoryRecorder, useVideoRecorder };
|
|
1389
|
+
export { type ActuatedJointInfo, type ActuatorInfo, type Actuators, type Bodies, Body, type BodyInfo, type BodyProps, type BodyStateResult, type CameraAnimationAPI, type ContactInfo, ContactListener, type ContactListenerProps, ContactMarkers, type ControlGroupInfo, type ControlGroupSelector, type ControlJointInfo, type ControllerComponent, type ControllerOptions, type CtrlHandle, Debug, type DebugProps, DragInteraction, type DragInteractionProps, FlexRenderer, type GeomInfo, type Geoms, type IKSolveFn, type IkConfig, type IkContextValue, IkGizmo, type IkGizmoProps, type JointInfo, type JointStateResult, type Joints, type KeyBinding, type KeyboardTeleopConfig, type Keyframes, type ModelOptions, MujocoCanvas, type MujocoCanvasProps, type MujocoContact, type MujocoContactArray, type MujocoContextValue, type MujocoData, type MujocoLoader, type MujocoLoaderOptions, type MujocoModel, type MujocoModule, MujocoPhysics, type MujocoPhysicsProps, MujocoProvider, type MujocoProviderProps, type MujocoSimAPI, MujocoSimProvider, type MujocoWasmVariant, type PhysicsConfig, type PhysicsStepCallback, type PlaybackState, type PolicyConfig, type RayHit, type Register, type ResourceSelector, type SceneConfig, SceneLights, type SceneLightsProps, type SceneMarker, type SceneObject, type SensorHandle, type SensorInfo, type SensorResult, type Sensors, type SiteInfo, type SitePositionResult, type Sites, type StateSnapshot, TendonRenderer, type TrajectoryData, type TrajectoryFrame, type TrajectoryInput, TrajectoryPlayer, type TrajectoryPlayerProps, type XmlPatch, createContiguousControlGroup, createController, createControllerHook, findActuatorByName, findBodyByName, findGeomByName, findJointByName, findKeyframeByName, findSensorByName, findSiteByName, findTendonByName, getActuatedJoints, getContact, getControlMap, getName, loadScene, resolveControlGroup, useActuators, useAfterPhysicsStep, useBeforePhysicsStep, useBodyMeshes, useBodyState, useCameraAnimation, useContactEvents, useContacts, useCtrl, useCtrlNoise, useGamepad, useGravityCompensation, useIkController, useJointState, useKeyboardTeleop, useMujoco, useMujocoWasm, usePolicy, useSceneLights, useSelectionHighlight, useSensor, useSensors, useSitePosition, useTrajectoryPlayer, useTrajectoryRecorder, useVideoRecorder };
|