mujoco-react 8.9.2 → 8.11.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 +82 -1
- package/dist/chunk-SEWQULWO.js +400 -0
- package/dist/chunk-SEWQULWO.js.map +1 -0
- package/dist/index.d.ts +114 -744
- package/dist/index.js +329 -35
- package/dist/index.js.map +1 -1
- package/dist/spark.d.ts +53 -0
- package/dist/spark.js +235 -0
- package/dist/spark.js.map +1 -0
- package/dist/types-BmneHLBM.d.ts +871 -0
- package/dist/vite.d.ts +9 -0
- package/dist/vite.js +4 -0
- package/dist/vite.js.map +1 -1
- package/package.json +15 -2
- package/src/components/Body.tsx +3 -1
- package/src/components/VisualScenario.tsx +566 -0
- package/src/core/MujocoCanvas.tsx +8 -1
- package/src/core/SceneLoader.ts +182 -3
- package/src/hooks/useFrameCapture.ts +206 -0
- package/src/hooks/usePolicy.ts +12 -8
- package/src/hooks/useSceneLights.ts +49 -18
- package/src/index.ts +48 -0
- package/src/spark.tsx +336 -0
- package/src/types.ts +159 -3
- package/src/vite.ts +8 -0
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import { CanvasProps, ThreeElements } from '@react-three/fiber';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Module augmentation interface for type-safe resource names.
|
|
12
|
+
*
|
|
13
|
+
* Declare your model's resource names via module augmentation:
|
|
14
|
+
* ```ts
|
|
15
|
+
* declare module 'mujoco-react' {
|
|
16
|
+
* interface Register {
|
|
17
|
+
* robots: {
|
|
18
|
+
* panda: {
|
|
19
|
+
* actuators: 'joint1' | 'joint2' | 'gripper';
|
|
20
|
+
* sensors: 'force_sensor' | 'torque_sensor';
|
|
21
|
+
* bodies: 'link0' | 'link1' | 'hand';
|
|
22
|
+
* };
|
|
23
|
+
* };
|
|
24
|
+
* actuators: 'joint1' | 'joint2' | 'gripper';
|
|
25
|
+
* sensors: 'force_sensor' | 'torque_sensor';
|
|
26
|
+
* bodies: 'link0' | 'link1' | 'hand';
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* When no augmentation is declared, all names fall back to `string`.
|
|
32
|
+
*/
|
|
33
|
+
interface Register {
|
|
34
|
+
}
|
|
35
|
+
type RegisteredRobotMap = Register extends {
|
|
36
|
+
robots: infer T extends Record<string, Record<string, string>>;
|
|
37
|
+
} ? T : never;
|
|
38
|
+
type Robots = [RegisteredRobotMap] extends [never] ? string : Extract<keyof RegisteredRobotMap, string>;
|
|
39
|
+
type RobotResource<TRobot extends string, TKey extends string> = [
|
|
40
|
+
RegisteredRobotMap
|
|
41
|
+
] extends [never] ? string : TRobot extends keyof RegisteredRobotMap ? TKey extends keyof RegisteredRobotMap[TRobot] ? RegisteredRobotMap[TRobot][TKey] : string : never;
|
|
42
|
+
type RegisterResourceKey = 'actuators' | 'sensors' | 'bodies' | 'joints' | 'sites' | 'geoms' | 'keyframes';
|
|
43
|
+
type RobotResourceObject<TRobot extends string, TKey extends RegisterResourceKey> = string extends RobotResource<TRobot, TKey> ? Record<string, string> : {
|
|
44
|
+
readonly [K in RobotResource<TRobot, TKey>]: K;
|
|
45
|
+
};
|
|
46
|
+
type RobotResourceCategory<TKey extends RegisterResourceKey> = string extends Robots ? Record<string, Record<string, string>> : {
|
|
47
|
+
readonly [TRobot in Robots]: RobotResourceObject<TRobot, TKey>;
|
|
48
|
+
};
|
|
49
|
+
type RobotResourceRegistry = string extends Robots ? Record<string, Record<RegisterResourceKey, Record<string, string>>> : {
|
|
50
|
+
readonly [TRobot in Robots]: {
|
|
51
|
+
readonly [TKey in RegisterResourceKey]: RobotResourceObject<TRobot, TKey>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
type RuntimeRobotResourceRegistration = Readonly<Record<string, Readonly<Record<RegisterResourceKey, Readonly<Record<string, string>>>>>>;
|
|
55
|
+
declare function registerRobotResources(resources: RuntimeRobotResourceRegistration): void;
|
|
56
|
+
declare const RobotResources: RobotResourceRegistry;
|
|
57
|
+
type RobotActuators<TRobot extends string> = RobotResource<TRobot, 'actuators'>;
|
|
58
|
+
declare const RobotActuators: RobotResourceCategory<'actuators'>;
|
|
59
|
+
type RobotSensors<TRobot extends string> = RobotResource<TRobot, 'sensors'>;
|
|
60
|
+
declare const RobotSensors: RobotResourceCategory<'sensors'>;
|
|
61
|
+
type RobotBodies<TRobot extends string> = RobotResource<TRobot, 'bodies'>;
|
|
62
|
+
declare const RobotBodies: RobotResourceCategory<'bodies'>;
|
|
63
|
+
type RobotJoints<TRobot extends string> = RobotResource<TRobot, 'joints'>;
|
|
64
|
+
declare const RobotJoints: RobotResourceCategory<'joints'>;
|
|
65
|
+
type RobotSites<TRobot extends string> = RobotResource<TRobot, 'sites'>;
|
|
66
|
+
declare const RobotSites: RobotResourceCategory<'sites'>;
|
|
67
|
+
type RobotGeoms<TRobot extends string> = RobotResource<TRobot, 'geoms'>;
|
|
68
|
+
declare const RobotGeoms: RobotResourceCategory<'geoms'>;
|
|
69
|
+
type RobotKeyframes<TRobot extends string> = RobotResource<TRobot, 'keyframes'>;
|
|
70
|
+
declare const RobotKeyframes: RobotResourceCategory<'keyframes'>;
|
|
71
|
+
type Actuators = Register extends {
|
|
72
|
+
actuators: infer T extends string;
|
|
73
|
+
} ? T : string;
|
|
74
|
+
type Sensors = Register extends {
|
|
75
|
+
sensors: infer T extends string;
|
|
76
|
+
} ? T : string;
|
|
77
|
+
type Bodies = Register extends {
|
|
78
|
+
bodies: infer T extends string;
|
|
79
|
+
} ? T : string;
|
|
80
|
+
type Joints = Register extends {
|
|
81
|
+
joints: infer T extends string;
|
|
82
|
+
} ? T : string;
|
|
83
|
+
type Sites = Register extends {
|
|
84
|
+
sites: infer T extends string;
|
|
85
|
+
} ? T : string;
|
|
86
|
+
type Geoms = Register extends {
|
|
87
|
+
geoms: infer T extends string;
|
|
88
|
+
} ? T : string;
|
|
89
|
+
type Keyframes = Register extends {
|
|
90
|
+
keyframes: infer T extends string;
|
|
91
|
+
} ? T : string;
|
|
92
|
+
/**
|
|
93
|
+
* A single MuJoCo contact from the WASM module.
|
|
94
|
+
* Accessed via `data.contact.get(i)`.
|
|
95
|
+
*/
|
|
96
|
+
interface MujocoContact {
|
|
97
|
+
geom1: number;
|
|
98
|
+
geom2: number;
|
|
99
|
+
pos: Float64Array;
|
|
100
|
+
frame: Float64Array;
|
|
101
|
+
dist: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* WASM contact array — supports indexed access via `.get(i)`.
|
|
105
|
+
*/
|
|
106
|
+
interface MujocoContactArray {
|
|
107
|
+
get(i: number): MujocoContact | undefined;
|
|
108
|
+
delete?: () => void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Read a single contact from an already-acquired WASM contact array.
|
|
112
|
+
* Returns undefined if the access fails (WASM heap issue, bad index, etc.).
|
|
113
|
+
*/
|
|
114
|
+
declare function getContact(contacts: MujocoContactArray, i: number): MujocoContact | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Minimal interface for MuJoCo Model to avoid 'any'.
|
|
117
|
+
*/
|
|
118
|
+
interface MujocoModel {
|
|
119
|
+
nbody: number;
|
|
120
|
+
ngeom: number;
|
|
121
|
+
nsite: number;
|
|
122
|
+
nu: number;
|
|
123
|
+
njnt: number;
|
|
124
|
+
nq: number;
|
|
125
|
+
nv: number;
|
|
126
|
+
nkey: number;
|
|
127
|
+
nsensor: number;
|
|
128
|
+
nsensordata: number;
|
|
129
|
+
nlight: number;
|
|
130
|
+
ntendon: number;
|
|
131
|
+
nflex: number;
|
|
132
|
+
nmesh: number;
|
|
133
|
+
nmat: number;
|
|
134
|
+
names: Int8Array;
|
|
135
|
+
name_bodyadr: Int32Array;
|
|
136
|
+
name_jntadr: Int32Array;
|
|
137
|
+
name_geomadr: Int32Array;
|
|
138
|
+
name_siteadr: Int32Array;
|
|
139
|
+
name_actuatoradr: Int32Array;
|
|
140
|
+
name_keyadr: Int32Array;
|
|
141
|
+
name_sensoradr: Int32Array;
|
|
142
|
+
name_tendonadr: Int32Array;
|
|
143
|
+
body_mass: Float64Array;
|
|
144
|
+
body_parentid: Int32Array;
|
|
145
|
+
body_jntnum: Int32Array;
|
|
146
|
+
body_jntadr: Int32Array;
|
|
147
|
+
body_pos: Float64Array;
|
|
148
|
+
body_quat: Float64Array;
|
|
149
|
+
body_geomnum: Int32Array;
|
|
150
|
+
body_geomadr: Int32Array;
|
|
151
|
+
body_inertia: Float64Array;
|
|
152
|
+
qpos0: Float64Array;
|
|
153
|
+
jnt_qposadr: Int32Array;
|
|
154
|
+
jnt_dofadr: Int32Array;
|
|
155
|
+
jnt_type: Int32Array;
|
|
156
|
+
jnt_range: Float64Array;
|
|
157
|
+
jnt_bodyid: Int32Array;
|
|
158
|
+
jnt_pos: Float64Array;
|
|
159
|
+
jnt_axis: Float64Array;
|
|
160
|
+
jnt_limited: Uint8Array;
|
|
161
|
+
geom_group: Int32Array;
|
|
162
|
+
geom_type: Int32Array;
|
|
163
|
+
geom_size: Float64Array;
|
|
164
|
+
geom_pos: Float64Array;
|
|
165
|
+
geom_quat: Float64Array;
|
|
166
|
+
geom_matid: Int32Array;
|
|
167
|
+
geom_rgba: Float32Array;
|
|
168
|
+
geom_dataid: Int32Array;
|
|
169
|
+
geom_bodyid: Int32Array;
|
|
170
|
+
geom_contype: Int32Array;
|
|
171
|
+
geom_conaffinity: Int32Array;
|
|
172
|
+
geom_friction: Float64Array;
|
|
173
|
+
mat_rgba: Float32Array;
|
|
174
|
+
mesh_vertadr: Int32Array;
|
|
175
|
+
mesh_vertnum: Int32Array;
|
|
176
|
+
mesh_faceadr: Int32Array;
|
|
177
|
+
mesh_facenum: Int32Array;
|
|
178
|
+
mesh_vert: Float32Array;
|
|
179
|
+
mesh_face: Int32Array;
|
|
180
|
+
mesh_normal: Float32Array;
|
|
181
|
+
site_bodyid: Int32Array;
|
|
182
|
+
actuator_trnid: Int32Array;
|
|
183
|
+
actuator_ctrlrange: Float64Array;
|
|
184
|
+
actuator_trntype: Int32Array;
|
|
185
|
+
actuator_gainprm: Float64Array;
|
|
186
|
+
actuator_biasprm: Float64Array;
|
|
187
|
+
sensor_type: Int32Array;
|
|
188
|
+
sensor_dim: Int32Array;
|
|
189
|
+
sensor_adr: Int32Array;
|
|
190
|
+
sensor_objtype: Int32Array;
|
|
191
|
+
sensor_objid: Int32Array;
|
|
192
|
+
key_qpos: Float64Array;
|
|
193
|
+
key_ctrl: Float64Array;
|
|
194
|
+
key_time: Float64Array;
|
|
195
|
+
key_qvel: Float64Array;
|
|
196
|
+
light_pos: Float64Array;
|
|
197
|
+
light_dir: Float64Array;
|
|
198
|
+
light_diffuse: Float32Array;
|
|
199
|
+
light_specular: Float32Array;
|
|
200
|
+
light_type: Int32Array;
|
|
201
|
+
light_active: Uint8Array;
|
|
202
|
+
light_castshadow: Uint8Array;
|
|
203
|
+
light_attenuation: Float32Array;
|
|
204
|
+
light_cutoff: Float32Array;
|
|
205
|
+
light_exponent: Float32Array;
|
|
206
|
+
light_intensity: Float32Array;
|
|
207
|
+
ten_wrapadr: Int32Array;
|
|
208
|
+
ten_wrapnum: Int32Array;
|
|
209
|
+
ten_range: Float64Array;
|
|
210
|
+
ten_rgba: Float32Array;
|
|
211
|
+
ten_width: Float64Array;
|
|
212
|
+
flex_vertadr: Int32Array;
|
|
213
|
+
flex_vertnum: Int32Array;
|
|
214
|
+
flex_faceadr: Int32Array;
|
|
215
|
+
flex_facenum: Int32Array;
|
|
216
|
+
flex_face: Int32Array;
|
|
217
|
+
flex_rgba: Float32Array;
|
|
218
|
+
opt: {
|
|
219
|
+
timestep: number;
|
|
220
|
+
gravity: Float64Array;
|
|
221
|
+
integrator: number;
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
};
|
|
224
|
+
delete: () => void;
|
|
225
|
+
[key: string]: unknown;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Minimal interface for MuJoCo Data to avoid 'any'.
|
|
229
|
+
*/
|
|
230
|
+
interface MujocoData {
|
|
231
|
+
time: number;
|
|
232
|
+
qpos: Float64Array;
|
|
233
|
+
qvel: Float64Array;
|
|
234
|
+
ctrl: Float64Array;
|
|
235
|
+
act: Float64Array;
|
|
236
|
+
xpos: Float64Array;
|
|
237
|
+
xquat: Float64Array;
|
|
238
|
+
xfrc_applied: Float64Array;
|
|
239
|
+
qfrc_applied: Float64Array;
|
|
240
|
+
qfrc_bias: Float64Array;
|
|
241
|
+
site_xpos: Float64Array;
|
|
242
|
+
site_xmat: Float64Array;
|
|
243
|
+
sensordata: Float64Array;
|
|
244
|
+
ncon: number;
|
|
245
|
+
contact: MujocoContactArray;
|
|
246
|
+
cvel: Float64Array;
|
|
247
|
+
cfrc_ext: Float64Array;
|
|
248
|
+
ten_length: Float64Array;
|
|
249
|
+
wrap_xpos: Float64Array;
|
|
250
|
+
ten_wrapadr: Int32Array;
|
|
251
|
+
flexvert_xpos: Float64Array;
|
|
252
|
+
geom_xpos: Float64Array;
|
|
253
|
+
geom_xmat: Float64Array;
|
|
254
|
+
delete: () => void;
|
|
255
|
+
[key: string]: unknown;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Minimal interface for the MuJoCo WASM Module.
|
|
259
|
+
*/
|
|
260
|
+
interface MujocoModule {
|
|
261
|
+
MjModel: {
|
|
262
|
+
from_xml_path?: (path: string) => MujocoModel;
|
|
263
|
+
from_xml_string?: (xml: string, vfs?: unknown) => MujocoModel;
|
|
264
|
+
loadFromXML?: (path: string) => MujocoModel;
|
|
265
|
+
[key: string]: unknown;
|
|
266
|
+
};
|
|
267
|
+
MjData: new (model: MujocoModel) => MujocoData;
|
|
268
|
+
MjvOption: new () => {
|
|
269
|
+
delete: () => void;
|
|
270
|
+
[key: string]: unknown;
|
|
271
|
+
};
|
|
272
|
+
mj_forward: (m: MujocoModel, d: MujocoData) => void;
|
|
273
|
+
mj_step: (m: MujocoModel, d: MujocoData) => void;
|
|
274
|
+
mj_resetData: (m: MujocoModel, d: MujocoData) => void;
|
|
275
|
+
mj_step1: (m: MujocoModel, d: MujocoData) => void;
|
|
276
|
+
mj_step2: (m: MujocoModel, d: MujocoData) => void;
|
|
277
|
+
mj_applyFT: (model: MujocoModel, data: MujocoData, force: Float64Array, torque: Float64Array, point: Float64Array, bodyId: number, qfrc_target: Float64Array) => void;
|
|
278
|
+
mj_ray: (model: MujocoModel, data: MujocoData, pnt: Float64Array, vec: Float64Array, geomgroup: Uint8Array | null, flg_static: number, bodyexclude: number, geomid: Int32Array) => number;
|
|
279
|
+
mj_name2id: (model: MujocoModel, type: number, name: string) => number;
|
|
280
|
+
mjtObj: Record<string, number>;
|
|
281
|
+
mjtGeom: Record<string, number | {
|
|
282
|
+
value: number;
|
|
283
|
+
}>;
|
|
284
|
+
mjtJoint: Record<string, number | {
|
|
285
|
+
value: number;
|
|
286
|
+
}>;
|
|
287
|
+
mjtSensor: Record<string, number | {
|
|
288
|
+
value: number;
|
|
289
|
+
}>;
|
|
290
|
+
FS: {
|
|
291
|
+
writeFile: (path: string, content: string | Uint8Array) => void;
|
|
292
|
+
readFile: (path: string, opts?: {
|
|
293
|
+
encoding: string;
|
|
294
|
+
}) => string | Uint8Array;
|
|
295
|
+
mkdir: (path: string) => void;
|
|
296
|
+
unmount: (path: string) => void;
|
|
297
|
+
};
|
|
298
|
+
[key: string]: unknown;
|
|
299
|
+
}
|
|
300
|
+
interface SceneObject {
|
|
301
|
+
name: string;
|
|
302
|
+
type: 'box' | 'sphere' | 'cylinder';
|
|
303
|
+
size: [number, number, number];
|
|
304
|
+
position: [number, number, number];
|
|
305
|
+
rgba: [number, number, number, number];
|
|
306
|
+
mass?: number;
|
|
307
|
+
freejoint?: boolean;
|
|
308
|
+
friction?: string;
|
|
309
|
+
solref?: string;
|
|
310
|
+
solimp?: string;
|
|
311
|
+
condim?: number;
|
|
312
|
+
/** MuJoCo geom group. Group 3 is conventionally used for collision-only helper geoms. */
|
|
313
|
+
group?: number;
|
|
314
|
+
}
|
|
315
|
+
interface XmlPatch {
|
|
316
|
+
target: string;
|
|
317
|
+
inject?: string;
|
|
318
|
+
injectAfter?: string;
|
|
319
|
+
replace?: [string, string];
|
|
320
|
+
}
|
|
321
|
+
type LocalMujocoFile = File;
|
|
322
|
+
interface LoadFromFilesOptions {
|
|
323
|
+
/** Entry MJCF/URDF file. Inferred from scene.xml, model.xml, robot.xml, or the first XML/URDF file when omitted. */
|
|
324
|
+
sceneFile?: string;
|
|
325
|
+
/** Additional MJCF environment XML files merged into the entry scene before MuJoCo compilation. */
|
|
326
|
+
environmentFiles?: string[];
|
|
327
|
+
homeJoints?: number[];
|
|
328
|
+
xmlPatches?: XmlPatch[];
|
|
329
|
+
sceneObjects?: SceneObject[];
|
|
330
|
+
onReset?: (model: MujocoModel, data: MujocoData) => void;
|
|
331
|
+
}
|
|
332
|
+
interface SceneConfig {
|
|
333
|
+
/** Base URL for fetching model files. The loader fetches `src + sceneFile` and follows dependencies. */
|
|
334
|
+
src: string;
|
|
335
|
+
/** Entry MJCF XML or URDF file name, e.g. 'scene.xml' or 'robot.urdf'. */
|
|
336
|
+
sceneFile: string;
|
|
337
|
+
/** Browser-selected files for local MJCF/URDF loading. Preserves webkitRelativePath when available. */
|
|
338
|
+
files?: readonly LocalMujocoFile[];
|
|
339
|
+
/**
|
|
340
|
+
* Additional MJCF environment XML files merged into the entry scene before compilation.
|
|
341
|
+
*
|
|
342
|
+
* Use this for static collision/physics layers such as a Gaussian-splat
|
|
343
|
+
* environment's proxy `scene.xml`; render the splat itself as a separate
|
|
344
|
+
* visual layer.
|
|
345
|
+
*/
|
|
346
|
+
environmentFiles?: string[];
|
|
347
|
+
sceneObjects?: SceneObject[];
|
|
348
|
+
homeJoints?: number[];
|
|
349
|
+
xmlPatches?: XmlPatch[];
|
|
350
|
+
onReset?: (model: MujocoModel, data: MujocoData) => void;
|
|
351
|
+
}
|
|
352
|
+
type ResourceSelector<TInfo, TName extends string = string> = TName | readonly TName[] | RegExp | ((info: TInfo) => boolean);
|
|
353
|
+
interface IkConfig {
|
|
354
|
+
/** MuJoCo site name for IK target. */
|
|
355
|
+
siteName: Sites;
|
|
356
|
+
/**
|
|
357
|
+
* Explicit joints for IK. When omitted, the controller infers scalar hinge/slide
|
|
358
|
+
* joints by walking from the site body to the model root.
|
|
359
|
+
*/
|
|
360
|
+
joints?: ResourceSelector<JointInfo, Joints>;
|
|
361
|
+
/** Explicit actuators for IK control output. */
|
|
362
|
+
actuators?: ResourceSelector<ActuatorInfo, Actuators>;
|
|
363
|
+
/**
|
|
364
|
+
* Number of joints to solve for, assuming legacy contiguous qpos/ctrl layout
|
|
365
|
+
* starting at index 0. Prefer inferred IK or `joints`/`actuators`.
|
|
366
|
+
*/
|
|
367
|
+
numJoints?: number;
|
|
368
|
+
/** Custom IK solver. When omitted, uses built-in Damped Least-Squares solver. */
|
|
369
|
+
ikSolveFn?: IKSolveFn;
|
|
370
|
+
/** DLS damping. Default: 0.01. */
|
|
371
|
+
damping?: number;
|
|
372
|
+
/** Max solver iterations. Default: 50. */
|
|
373
|
+
maxIterations?: number;
|
|
374
|
+
}
|
|
375
|
+
interface IkContextValue {
|
|
376
|
+
ikEnabledRef: React__default.RefObject<boolean>;
|
|
377
|
+
ikCalculatingRef: React__default.RefObject<boolean>;
|
|
378
|
+
ikTargetRef: React__default.RefObject<THREE.Group>;
|
|
379
|
+
siteIdRef: React__default.RefObject<number>;
|
|
380
|
+
setIkEnabled: (enabled: boolean) => void;
|
|
381
|
+
moveTarget: (pos: THREE.Vector3, duration?: number) => void;
|
|
382
|
+
syncTargetToSite: () => void;
|
|
383
|
+
solveIK: (pos: THREE.Vector3, quat: THREE.Quaternion, currentQ: number[]) => number[] | null;
|
|
384
|
+
getGizmoStats: () => {
|
|
385
|
+
pos: THREE.Vector3;
|
|
386
|
+
rot: THREE.Euler;
|
|
387
|
+
} | null;
|
|
388
|
+
}
|
|
389
|
+
interface SceneMarker {
|
|
390
|
+
id: number;
|
|
391
|
+
position: THREE.Vector3;
|
|
392
|
+
label: string;
|
|
393
|
+
}
|
|
394
|
+
interface PhysicsConfig {
|
|
395
|
+
gravity?: [number, number, number];
|
|
396
|
+
timestep?: number;
|
|
397
|
+
substeps?: number;
|
|
398
|
+
paused?: boolean;
|
|
399
|
+
speed?: number;
|
|
400
|
+
}
|
|
401
|
+
type IKSolveFn = (pos: THREE.Vector3, quat: THREE.Quaternion, currentQ: number[], context?: IKSolveContext) => number[] | null;
|
|
402
|
+
interface IKSolveContext {
|
|
403
|
+
model: MujocoModel;
|
|
404
|
+
data: MujocoData;
|
|
405
|
+
siteId: number;
|
|
406
|
+
controlGroup: ControlGroupInfo;
|
|
407
|
+
}
|
|
408
|
+
type PhysicsStepCallback = (model: MujocoModel, data: MujocoData) => void;
|
|
409
|
+
interface StateSnapshot {
|
|
410
|
+
time: number;
|
|
411
|
+
qpos: Float64Array;
|
|
412
|
+
qvel: Float64Array;
|
|
413
|
+
ctrl: Float64Array;
|
|
414
|
+
act: Float64Array;
|
|
415
|
+
qfrc_applied: Float64Array;
|
|
416
|
+
}
|
|
417
|
+
interface BodyInfo {
|
|
418
|
+
id: number;
|
|
419
|
+
name: string;
|
|
420
|
+
mass: number;
|
|
421
|
+
parentId: number;
|
|
422
|
+
}
|
|
423
|
+
interface JointInfo {
|
|
424
|
+
id: number;
|
|
425
|
+
name: string;
|
|
426
|
+
type: number;
|
|
427
|
+
typeName: string;
|
|
428
|
+
range: [number, number];
|
|
429
|
+
limited: boolean;
|
|
430
|
+
bodyId: number;
|
|
431
|
+
qposAdr: number;
|
|
432
|
+
dofAdr: number;
|
|
433
|
+
}
|
|
434
|
+
interface GeomInfo {
|
|
435
|
+
id: number;
|
|
436
|
+
name: string;
|
|
437
|
+
type: number;
|
|
438
|
+
typeName: string;
|
|
439
|
+
size: [number, number, number];
|
|
440
|
+
bodyId: number;
|
|
441
|
+
}
|
|
442
|
+
interface SiteInfo {
|
|
443
|
+
id: number;
|
|
444
|
+
name: string;
|
|
445
|
+
bodyId: number;
|
|
446
|
+
}
|
|
447
|
+
interface ActuatorInfo {
|
|
448
|
+
id: number;
|
|
449
|
+
name: string;
|
|
450
|
+
range: [number, number];
|
|
451
|
+
}
|
|
452
|
+
interface ActuatedJointInfo extends JointInfo {
|
|
453
|
+
actuatorId: number;
|
|
454
|
+
actuatorName: string;
|
|
455
|
+
ctrlAdr: number;
|
|
456
|
+
ctrlRange: [number, number];
|
|
457
|
+
}
|
|
458
|
+
interface ControlJointInfo extends JointInfo {
|
|
459
|
+
actuatorId: number | null;
|
|
460
|
+
actuatorName: string | null;
|
|
461
|
+
ctrlAdr: number | null;
|
|
462
|
+
ctrlRange: [number, number] | null;
|
|
463
|
+
}
|
|
464
|
+
interface ControlGroupSelector {
|
|
465
|
+
/** Infer a kinematic chain from a MuJoCo site. */
|
|
466
|
+
siteName?: Sites;
|
|
467
|
+
/** Infer a kinematic chain from a body. */
|
|
468
|
+
bodyName?: Bodies;
|
|
469
|
+
/** Select joints by name, names, regex, or predicate. */
|
|
470
|
+
joints?: ResourceSelector<JointInfo, Joints>;
|
|
471
|
+
/** Select actuators by name, names, regex, or predicate. */
|
|
472
|
+
actuators?: ResourceSelector<ActuatorInfo, Actuators>;
|
|
473
|
+
}
|
|
474
|
+
interface ControlGroupInfo {
|
|
475
|
+
/** Joints in solve/control order. */
|
|
476
|
+
joints: ControlJointInfo[];
|
|
477
|
+
/** Actuators in control output order. */
|
|
478
|
+
actuators: ActuatorInfo[];
|
|
479
|
+
/** qpos addresses for scalar hinge/slide joints. */
|
|
480
|
+
qposAdr: number[];
|
|
481
|
+
/** dof addresses for scalar hinge/slide joints. */
|
|
482
|
+
dofAdr: number[];
|
|
483
|
+
/** ctrl addresses matching writable actuators. */
|
|
484
|
+
ctrlAdr: number[];
|
|
485
|
+
readQpos(data: MujocoData): Float64Array;
|
|
486
|
+
readCtrl(data: MujocoData): Float64Array;
|
|
487
|
+
writeQpos(data: MujocoData, values: ArrayLike<number>): void;
|
|
488
|
+
writeCtrl(data: MujocoData, values: ArrayLike<number>): void;
|
|
489
|
+
}
|
|
490
|
+
interface SensorInfo {
|
|
491
|
+
id: number;
|
|
492
|
+
name: string;
|
|
493
|
+
type: number;
|
|
494
|
+
typeName: string;
|
|
495
|
+
dim: number;
|
|
496
|
+
adr: number;
|
|
497
|
+
}
|
|
498
|
+
interface ContactInfo {
|
|
499
|
+
geom1: number;
|
|
500
|
+
geom1Name: string;
|
|
501
|
+
geom2: number;
|
|
502
|
+
geom2Name: string;
|
|
503
|
+
pos: [number, number, number];
|
|
504
|
+
depth: number;
|
|
505
|
+
}
|
|
506
|
+
interface RayHit {
|
|
507
|
+
point: THREE.Vector3;
|
|
508
|
+
bodyId: number;
|
|
509
|
+
geomId: number;
|
|
510
|
+
distance: number;
|
|
511
|
+
}
|
|
512
|
+
interface ModelOptions {
|
|
513
|
+
timestep: number;
|
|
514
|
+
gravity: [number, number, number];
|
|
515
|
+
integrator: number;
|
|
516
|
+
}
|
|
517
|
+
interface TrajectoryFrame {
|
|
518
|
+
time: number;
|
|
519
|
+
qpos: Float64Array;
|
|
520
|
+
qvel?: Float64Array;
|
|
521
|
+
ctrl?: Float64Array;
|
|
522
|
+
sensordata?: Float64Array;
|
|
523
|
+
}
|
|
524
|
+
interface TrajectoryData {
|
|
525
|
+
frames: TrajectoryFrame[];
|
|
526
|
+
fps: number;
|
|
527
|
+
}
|
|
528
|
+
type PlaybackState = 'idle' | 'playing' | 'paused' | 'completed';
|
|
529
|
+
interface KeyBinding {
|
|
530
|
+
actuator: Actuators;
|
|
531
|
+
delta?: number;
|
|
532
|
+
toggle?: [number, number];
|
|
533
|
+
set?: number;
|
|
534
|
+
}
|
|
535
|
+
interface KeyboardTeleopConfig {
|
|
536
|
+
bindings: Record<string, KeyBinding>;
|
|
537
|
+
enabled?: boolean;
|
|
538
|
+
}
|
|
539
|
+
type PolicyVector = Float32Array | Float64Array | number[];
|
|
540
|
+
interface PolicyObservationInput {
|
|
541
|
+
model: MujocoModel;
|
|
542
|
+
data: MujocoData;
|
|
543
|
+
}
|
|
544
|
+
interface PolicyInferenceInput extends PolicyObservationInput {
|
|
545
|
+
observation: PolicyVector;
|
|
546
|
+
}
|
|
547
|
+
interface PolicyActionInput extends PolicyInferenceInput {
|
|
548
|
+
action: PolicyVector;
|
|
549
|
+
}
|
|
550
|
+
interface PolicyConfig {
|
|
551
|
+
frequency: number;
|
|
552
|
+
enabled?: boolean;
|
|
553
|
+
onObservation: (input: PolicyObservationInput) => PolicyVector;
|
|
554
|
+
/** Run policy inference. Omit to pass observations directly to `onAction` for custom inline controllers. */
|
|
555
|
+
infer?: (input: PolicyInferenceInput) => PolicyVector;
|
|
556
|
+
onAction: (input: PolicyActionInput) => void;
|
|
557
|
+
}
|
|
558
|
+
type ObservationOutput = 'float32' | 'float64';
|
|
559
|
+
interface ObservationConfig {
|
|
560
|
+
/** Include scalar simulation time. */
|
|
561
|
+
time?: boolean;
|
|
562
|
+
/** Include all qpos values. */
|
|
563
|
+
qpos?: boolean;
|
|
564
|
+
/** Include all qvel values. */
|
|
565
|
+
qvel?: boolean;
|
|
566
|
+
/** Include all ctrl values. */
|
|
567
|
+
ctrl?: boolean;
|
|
568
|
+
/** Include all actuator activation values. */
|
|
569
|
+
act?: boolean;
|
|
570
|
+
/** Include all raw sensordata values. */
|
|
571
|
+
sensordata?: boolean;
|
|
572
|
+
/** Include named sensor values in the configured order. */
|
|
573
|
+
sensors?: readonly Sensors[];
|
|
574
|
+
/** Include named site world positions in the configured order. */
|
|
575
|
+
sites?: readonly Sites[];
|
|
576
|
+
/** Include world gravity projected into each named body's local frame. */
|
|
577
|
+
projectedGravity?: Bodies | readonly Bodies[];
|
|
578
|
+
/** Output array type. Defaults to Float32Array. */
|
|
579
|
+
output?: ObservationOutput;
|
|
580
|
+
}
|
|
581
|
+
interface ObservationLayoutItem {
|
|
582
|
+
name: string;
|
|
583
|
+
start: number;
|
|
584
|
+
size: number;
|
|
585
|
+
}
|
|
586
|
+
interface ObservationResult {
|
|
587
|
+
values: Float32Array | Float64Array;
|
|
588
|
+
layout: ObservationLayoutItem[];
|
|
589
|
+
}
|
|
590
|
+
interface ObservationHandle {
|
|
591
|
+
/** Read a fresh observation from the current live MuJoCo model/data refs. */
|
|
592
|
+
read(): ObservationResult;
|
|
593
|
+
/** Read just the vector values for policy inference. */
|
|
594
|
+
readValues(): Float32Array | Float64Array;
|
|
595
|
+
}
|
|
596
|
+
interface DebugProps {
|
|
597
|
+
showGeoms?: boolean;
|
|
598
|
+
showSites?: boolean;
|
|
599
|
+
showJoints?: boolean;
|
|
600
|
+
showContacts?: boolean;
|
|
601
|
+
showCOM?: boolean;
|
|
602
|
+
showInertia?: boolean;
|
|
603
|
+
showTendons?: boolean;
|
|
604
|
+
}
|
|
605
|
+
interface IkGizmoProps {
|
|
606
|
+
controller: IkContextValue;
|
|
607
|
+
siteName?: string;
|
|
608
|
+
scale?: number;
|
|
609
|
+
onDrag?: (position: THREE.Vector3, quaternion: THREE.Quaternion) => void;
|
|
610
|
+
}
|
|
611
|
+
interface DragInteractionProps {
|
|
612
|
+
stiffness?: number;
|
|
613
|
+
showArrow?: boolean;
|
|
614
|
+
}
|
|
615
|
+
interface SceneLightsProps {
|
|
616
|
+
/** Override intensity for all MJCF lights. Default: 1.0. */
|
|
617
|
+
intensity?: number;
|
|
618
|
+
}
|
|
619
|
+
type ScenarioLightingPreset = 'studio' | 'warehouse' | 'low-light' | 'splat';
|
|
620
|
+
type SplatFormat = 'spz' | 'ply' | 'splat';
|
|
621
|
+
type SplatRendererKind = 'spark' | 'custom';
|
|
622
|
+
type SplatCollisionPrimitive = 'plane' | 'box' | 'sphere' | 'capsule' | 'mesh';
|
|
623
|
+
interface ScenarioCameraConfig {
|
|
624
|
+
jitter?: number;
|
|
625
|
+
exposure?: number;
|
|
626
|
+
noise?: number;
|
|
627
|
+
blur?: number;
|
|
628
|
+
}
|
|
629
|
+
interface ScenarioMaterialConfig {
|
|
630
|
+
randomizeObjectColors?: boolean;
|
|
631
|
+
randomizeTableMaterial?: boolean;
|
|
632
|
+
roughness?: number;
|
|
633
|
+
metalness?: number;
|
|
634
|
+
}
|
|
635
|
+
interface SplatAssetConfig {
|
|
636
|
+
src: string;
|
|
637
|
+
/** Common browser-friendly splat format. Renderer-specific loaders may accept more. */
|
|
638
|
+
format?: SplatFormat;
|
|
639
|
+
/** Optional renderer hint. The library does not import renderer-specific code. */
|
|
640
|
+
renderer?: SplatRendererKind;
|
|
641
|
+
}
|
|
642
|
+
interface SplatScenarioConfig {
|
|
643
|
+
enabled: boolean;
|
|
644
|
+
/** Common browser-friendly splat format. Renderer-specific loaders may accept more. */
|
|
645
|
+
format?: SplatFormat;
|
|
646
|
+
src?: string;
|
|
647
|
+
requiresCollisionProxy?: boolean;
|
|
648
|
+
collisionProxy?: SplatCollisionProxyConfig | null;
|
|
649
|
+
}
|
|
650
|
+
interface SplatCollisionProxyConfig {
|
|
651
|
+
/** MJCF/XML file or artifact path that provides physics collision for the visual splat. */
|
|
652
|
+
xmlPath?: string;
|
|
653
|
+
/** Human-readable status for authoring and validation flows. */
|
|
654
|
+
status?: 'missing' | 'planned' | 'generated' | 'validated';
|
|
655
|
+
/** Primitive proxy shapes expected in the MJCF collision proxy. */
|
|
656
|
+
primitives?: SplatCollisionPrimitive[];
|
|
657
|
+
/** Optional notes that should travel with scene variants and rollout metadata. */
|
|
658
|
+
notes?: string[];
|
|
659
|
+
}
|
|
660
|
+
interface PairedSplatEnvironmentConfig {
|
|
661
|
+
id: string;
|
|
662
|
+
label: string;
|
|
663
|
+
description?: string;
|
|
664
|
+
/** Visual-only Gaussian splat asset. */
|
|
665
|
+
splat: SplatAssetConfig;
|
|
666
|
+
/** MJCF/XML contact geometry paired with the visual splat. */
|
|
667
|
+
collisionProxy: SplatCollisionProxyConfig & {
|
|
668
|
+
xmlPath: string;
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
interface SplatEnvironmentMetadataInput {
|
|
672
|
+
environment?: PairedSplatEnvironmentConfig;
|
|
673
|
+
scenario?: VisualScenarioConfig;
|
|
674
|
+
renderer?: SplatRendererKind;
|
|
675
|
+
src?: string;
|
|
676
|
+
format?: SplatFormat;
|
|
677
|
+
collisionProxy?: SplatCollisionProxyConfig;
|
|
678
|
+
}
|
|
679
|
+
interface SplatEnvironmentMetadata {
|
|
680
|
+
src?: string;
|
|
681
|
+
format: SplatFormat;
|
|
682
|
+
collisionProxy?: SplatCollisionProxyConfig;
|
|
683
|
+
userData: Record<string, unknown>;
|
|
684
|
+
}
|
|
685
|
+
type SplatSceneInput = PairedSplatEnvironmentConfig | VisualScenarioConfig | undefined | null;
|
|
686
|
+
interface VisualScenarioConfig {
|
|
687
|
+
id?: string;
|
|
688
|
+
label?: string;
|
|
689
|
+
seed?: number;
|
|
690
|
+
lighting?: ScenarioLightingPreset;
|
|
691
|
+
environment?: string;
|
|
692
|
+
camera?: ScenarioCameraConfig;
|
|
693
|
+
materials?: ScenarioMaterialConfig;
|
|
694
|
+
splat?: SplatScenarioConfig | null;
|
|
695
|
+
}
|
|
696
|
+
interface ScenarioLightingProps {
|
|
697
|
+
preset?: ScenarioLightingPreset;
|
|
698
|
+
intensity?: number;
|
|
699
|
+
castShadow?: boolean;
|
|
700
|
+
}
|
|
701
|
+
interface SplatEnvironmentProps extends Omit<ThreeElements['group'], 'ref'> {
|
|
702
|
+
environment?: PairedSplatEnvironmentConfig;
|
|
703
|
+
scenario?: VisualScenarioConfig;
|
|
704
|
+
renderer?: SplatRendererKind;
|
|
705
|
+
src?: string;
|
|
706
|
+
format?: SplatFormat;
|
|
707
|
+
collisionProxy?: ReactNode;
|
|
708
|
+
collisionProxyMetadata?: SplatCollisionProxyConfig;
|
|
709
|
+
showPlaceholder?: boolean;
|
|
710
|
+
}
|
|
711
|
+
interface VisualScenarioEffectsProps {
|
|
712
|
+
scenario?: VisualScenarioConfig;
|
|
713
|
+
enabled?: boolean;
|
|
714
|
+
applyBackground?: boolean;
|
|
715
|
+
applyFog?: boolean;
|
|
716
|
+
applyRenderer?: boolean;
|
|
717
|
+
applyMaterials?: boolean;
|
|
718
|
+
background?: THREE.ColorRepresentation;
|
|
719
|
+
fogNear?: number;
|
|
720
|
+
fogFar?: number;
|
|
721
|
+
materialFilter?: (object: THREE.Object3D, material: THREE.Material) => boolean;
|
|
722
|
+
}
|
|
723
|
+
type TrajectoryInput = TrajectoryFrame[] | number[][];
|
|
724
|
+
interface TrajectoryPlayerProps {
|
|
725
|
+
trajectory: TrajectoryInput;
|
|
726
|
+
fps?: number;
|
|
727
|
+
speed?: number;
|
|
728
|
+
loop?: boolean;
|
|
729
|
+
playing?: boolean;
|
|
730
|
+
mode?: 'kinematic' | 'physics';
|
|
731
|
+
onFrame?: (frameIdx: number) => void;
|
|
732
|
+
onComplete?: () => void;
|
|
733
|
+
onStateChange?: (state: PlaybackState) => void;
|
|
734
|
+
}
|
|
735
|
+
interface ContactListenerProps {
|
|
736
|
+
body: Bodies;
|
|
737
|
+
onContactEnter?: (info: ContactInfo) => void;
|
|
738
|
+
onContactExit?: (info: ContactInfo) => void;
|
|
739
|
+
}
|
|
740
|
+
interface BodyProps {
|
|
741
|
+
name: Bodies;
|
|
742
|
+
type: 'box' | 'sphere' | 'cylinder';
|
|
743
|
+
size: [number, number, number];
|
|
744
|
+
position?: [number, number, number];
|
|
745
|
+
rgba?: [number, number, number, number];
|
|
746
|
+
mass?: number;
|
|
747
|
+
freejoint?: boolean;
|
|
748
|
+
friction?: string;
|
|
749
|
+
solref?: string;
|
|
750
|
+
solimp?: string;
|
|
751
|
+
condim?: number;
|
|
752
|
+
/** MuJoCo geom group. Group 3 is conventionally used for collision-only helper geoms. */
|
|
753
|
+
group?: number;
|
|
754
|
+
children?: ReactNode;
|
|
755
|
+
}
|
|
756
|
+
interface MujocoSimAPI {
|
|
757
|
+
readonly status: 'loading' | 'ready' | 'error';
|
|
758
|
+
readonly config: SceneConfig;
|
|
759
|
+
reset(): void;
|
|
760
|
+
setSpeed(multiplier: number): void;
|
|
761
|
+
togglePause(): boolean;
|
|
762
|
+
setPaused(paused: boolean): void;
|
|
763
|
+
step(n?: number): void;
|
|
764
|
+
getTime(): number;
|
|
765
|
+
getTimestep(): number;
|
|
766
|
+
applyKeyframe(nameOrIndex: Keyframes | number): void;
|
|
767
|
+
saveState(): StateSnapshot;
|
|
768
|
+
restoreState(snapshot: StateSnapshot): void;
|
|
769
|
+
setQpos(values: Float64Array | number[]): void;
|
|
770
|
+
setQvel(values: Float64Array | number[]): void;
|
|
771
|
+
getQpos(): Float64Array;
|
|
772
|
+
getQvel(): Float64Array;
|
|
773
|
+
setCtrl(nameOrValues: Actuators | Record<Actuators, number>, value?: number): void;
|
|
774
|
+
getCtrl(): Float64Array;
|
|
775
|
+
getControlMap(): ControlGroupInfo;
|
|
776
|
+
getActuatedJoints(): ActuatedJointInfo[];
|
|
777
|
+
resolveControlGroup(selector: ControlGroupSelector): ControlGroupInfo | null;
|
|
778
|
+
applyForce(bodyName: Bodies, force: THREE.Vector3, point?: THREE.Vector3): void;
|
|
779
|
+
applyTorque(bodyName: Bodies, torque: THREE.Vector3): void;
|
|
780
|
+
setExternalForce(bodyName: Bodies, force: THREE.Vector3, torque: THREE.Vector3): void;
|
|
781
|
+
applyGeneralizedForce(values: Float64Array | number[]): void;
|
|
782
|
+
getSensorData(name: Sensors): Float64Array | null;
|
|
783
|
+
getContacts(): ContactInfo[];
|
|
784
|
+
getBodies(): BodyInfo[];
|
|
785
|
+
getJoints(): JointInfo[];
|
|
786
|
+
getGeoms(): GeomInfo[];
|
|
787
|
+
getSites(): SiteInfo[];
|
|
788
|
+
getActuators(): ActuatorInfo[];
|
|
789
|
+
getSensors(): SensorInfo[];
|
|
790
|
+
getModelOption(): ModelOptions;
|
|
791
|
+
setGravity(g: [number, number, number]): void;
|
|
792
|
+
setTimestep(dt: number): void;
|
|
793
|
+
raycast(origin: THREE.Vector3, direction: THREE.Vector3, maxDist?: number): RayHit | null;
|
|
794
|
+
getKeyframeNames(): string[];
|
|
795
|
+
getKeyframeCount(): number;
|
|
796
|
+
loadScene(newConfig: SceneConfig): Promise<void>;
|
|
797
|
+
loadFromFiles(files: FileList | readonly LocalMujocoFile[], options?: LoadFromFilesOptions): Promise<void>;
|
|
798
|
+
addBody(body: SceneObject): Promise<void>;
|
|
799
|
+
removeBody(name: Bodies): Promise<void>;
|
|
800
|
+
recompile(patches?: XmlPatch[]): Promise<void>;
|
|
801
|
+
getCanvasSnapshot(width?: number, height?: number, mimeType?: string): string;
|
|
802
|
+
project2DTo3D(x: number, y: number, cameraPos: THREE.Vector3, lookAt: THREE.Vector3): {
|
|
803
|
+
point: THREE.Vector3;
|
|
804
|
+
bodyId: number;
|
|
805
|
+
geomId: number;
|
|
806
|
+
} | null;
|
|
807
|
+
setBodyMass(name: Bodies, mass: number): void;
|
|
808
|
+
setGeomFriction(name: Geoms, friction: [number, number, number]): void;
|
|
809
|
+
setGeomSize(name: Geoms, size: [number, number, number]): void;
|
|
810
|
+
readonly mjModelRef: React__default.RefObject<MujocoModel | null>;
|
|
811
|
+
readonly mjDataRef: React__default.RefObject<MujocoData | null>;
|
|
812
|
+
}
|
|
813
|
+
type MujocoCanvasProps = Omit<CanvasProps, 'onError'> & {
|
|
814
|
+
config: SceneConfig;
|
|
815
|
+
/** R3F content rendered while the MuJoCo WASM module is still loading. */
|
|
816
|
+
loadingFallback?: ReactNode;
|
|
817
|
+
onReady?: (api: MujocoSimAPI) => void;
|
|
818
|
+
onError?: (error: Error) => void;
|
|
819
|
+
onStep?: (time: number) => void;
|
|
820
|
+
onSelection?: (bodyId: number, name: string) => void;
|
|
821
|
+
gravity?: [number, number, number];
|
|
822
|
+
timestep?: number;
|
|
823
|
+
substeps?: number;
|
|
824
|
+
paused?: boolean;
|
|
825
|
+
speed?: number;
|
|
826
|
+
interpolate?: boolean;
|
|
827
|
+
};
|
|
828
|
+
interface SitePositionResult {
|
|
829
|
+
position: React__default.RefObject<THREE.Vector3>;
|
|
830
|
+
quaternion: React__default.RefObject<THREE.Quaternion>;
|
|
831
|
+
}
|
|
832
|
+
interface MujocoContextValue {
|
|
833
|
+
mujoco: MujocoModule | null;
|
|
834
|
+
status: 'loading' | 'ready' | 'error';
|
|
835
|
+
error: string | null;
|
|
836
|
+
}
|
|
837
|
+
/** @deprecated Use `SensorHandle` instead. */
|
|
838
|
+
interface SensorResult {
|
|
839
|
+
value: React__default.RefObject<Float64Array>;
|
|
840
|
+
size: number;
|
|
841
|
+
}
|
|
842
|
+
interface CtrlHandle {
|
|
843
|
+
/** Read the current ctrl value. */
|
|
844
|
+
read(): number;
|
|
845
|
+
/** Write a ctrl value (goes directly to data.ctrl). */
|
|
846
|
+
write(value: number): void;
|
|
847
|
+
/** Actuator name. */
|
|
848
|
+
name: Actuators;
|
|
849
|
+
/** Actuator control range [min, max]. */
|
|
850
|
+
range: [number, number];
|
|
851
|
+
}
|
|
852
|
+
interface SensorHandle {
|
|
853
|
+
/** Read the current sensor data. */
|
|
854
|
+
read(): Float64Array;
|
|
855
|
+
/** Sensor dimensionality. */
|
|
856
|
+
dim: number;
|
|
857
|
+
/** Sensor name. */
|
|
858
|
+
name: Sensors;
|
|
859
|
+
}
|
|
860
|
+
interface BodyStateResult {
|
|
861
|
+
position: React__default.RefObject<THREE.Vector3>;
|
|
862
|
+
quaternion: React__default.RefObject<THREE.Quaternion>;
|
|
863
|
+
linearVelocity: React__default.RefObject<THREE.Vector3>;
|
|
864
|
+
angularVelocity: React__default.RefObject<THREE.Vector3>;
|
|
865
|
+
}
|
|
866
|
+
interface JointStateResult {
|
|
867
|
+
position: React__default.RefObject<number | Float64Array>;
|
|
868
|
+
velocity: React__default.RefObject<number | Float64Array>;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
export { type TrajectoryInput as $, type ActuatedJointInfo as A, type BodyProps as B, type ControlGroupInfo as C, type DragInteractionProps as D, type SitePositionResult as E, type Sensors as F, type GeomInfo as G, type SensorHandle as H, type IkConfig as I, type SensorInfo as J, type Joints as K, type JointStateResult as L, type MujocoContextValue as M, type Bodies as N, type ObservationConfig as O, type PhysicsStepCallback as P, type BodyStateResult as Q, type Actuators as R, type SceneConfig as S, type TrajectoryPlayerProps as T, type CtrlHandle as U, type VisualScenarioEffectsProps as V, type ContactInfo as W, type KeyboardTeleopConfig as X, type PolicyConfig as Y, type PolicyVector as Z, type ObservationHandle as _, type MujocoCanvasProps as a, type PlaybackState as a0, type TrajectoryFrame as a1, type BodyInfo as a2, type ControlJointInfo as a3, type Geoms as a4, type IKSolveFn as a5, type JointInfo as a6, type KeyBinding as a7, type Keyframes as a8, type ModelOptions as a9, type SensorResult as aA, type SiteInfo as aB, type SplatAssetConfig as aC, type SplatScenarioConfig as aD, type StateSnapshot as aE, type TrajectoryData as aF, type XmlPatch as aG, getContact as aH, registerRobotResources as aI, type MujocoContact as aa, type MujocoContactArray as ab, type ObservationLayoutItem as ac, type ObservationOutput as ad, type PhysicsConfig as ae, type PolicyActionInput as af, type PolicyInferenceInput as ag, type PolicyObservationInput as ah, type RayHit as ai, type Register as aj, type RegisteredRobotMap as ak, type ResourceSelector as al, RobotActuators as am, RobotBodies as an, RobotGeoms as ao, RobotJoints as ap, RobotKeyframes as aq, type RobotResource as ar, RobotResources as as, RobotSensors as at, RobotSites as au, type Robots as av, type ScenarioCameraConfig as aw, type ScenarioMaterialConfig as ax, type SceneMarker as ay, type SceneObject as az, type MujocoSimAPI as b, type MujocoModule as c, type MujocoModel as d, type MujocoData as e, type ControlGroupSelector as f, type ObservationResult as g, type IkContextValue as h, type IkGizmoProps as i, type SceneLightsProps as j, type ScenarioLightingProps as k, type SplatEnvironmentProps as l, type VisualScenarioConfig as m, type SplatRendererKind as n, type PairedSplatEnvironmentConfig as o, type SplatFormat as p, type SplatCollisionProxyConfig as q, type SplatCollisionPrimitive as r, type ScenarioLightingPreset as s, type SplatEnvironmentMetadataInput as t, type SplatEnvironmentMetadata as u, type SplatSceneInput as v, type DebugProps as w, type ContactListenerProps as x, type ActuatorInfo as y, type Sites as z };
|