mujoco-react 8.9.2 → 8.10.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/dist/index.d.ts CHANGED
@@ -1,741 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { M as MujocoContextValue, a as MujocoCanvasProps, b as MujocoSimAPI, S as SceneConfig, c as MujocoModule, P as PhysicsStepCallback, d as MujocoModel, e as MujocoData, C as ControlGroupInfo, A as ActuatedJointInfo, f as ControlGroupSelector, O as ObservationConfig, g as ObservationResult, I as IkConfig, h as IkContextValue, B as BodyProps, i as IkGizmoProps, D as DragInteractionProps, j as SceneLightsProps, k as ScenarioLightingProps, l as SplatEnvironmentProps, m as PairedSplatEnvironmentConfig, n as SplatFormat, o as SplatCollisionProxyConfig, p as SplatRendererKind, q as SplatCollisionPrimitive, r as ScenarioLightingPreset, V as VisualScenarioConfig, s as SplatEnvironmentMetadataInput, t as SplatEnvironmentMetadata, u as DebugProps, G as GeomInfo, v as ContactListenerProps, T as TrajectoryPlayerProps, w as ActuatorInfo, x as Sites, y as SitePositionResult, z as Sensors, E as SensorHandle, F as SensorInfo, J as Joints, H as JointStateResult, K as Bodies, L as BodyStateResult, N as Actuators, Q as CtrlHandle, R as ContactInfo, U as KeyboardTeleopConfig, W as PolicyConfig, X as ObservationHandle, Y as TrajectoryInput, Z as PlaybackState, _ as TrajectoryFrame } from './types-FFW7ykBu.js';
3
+ export { $ as BodyInfo, a0 as ControlJointInfo, a1 as Geoms, a2 as IKSolveFn, a3 as JointInfo, a4 as KeyBinding, a5 as Keyframes, a6 as ModelOptions, a7 as MujocoContact, a8 as MujocoContactArray, a9 as ObservationLayoutItem, aa as ObservationOutput, ab as PhysicsConfig, ac as RayHit, ad as Register, ae as RegisteredRobotMap, af as ResourceSelector, ag as RobotActuators, ah as RobotBodies, ai as RobotGeoms, aj as RobotJoints, ak as RobotKeyframes, al as RobotResource, am as RobotResources, an as RobotSensors, ao as RobotSites, ap as Robots, aq as ScenarioCameraConfig, ar as SceneMarker, as as SceneObject, at as SensorResult, au as SiteInfo, av as SplatAssetConfig, aw as SplatScenarioConfig, ax as StateSnapshot, ay as TrajectoryData, az as XmlPatch, aA as getContact, aB as registerRobotResources } from './types-FFW7ykBu.js';
2
4
  import * as React$1 from 'react';
3
- import React__default, { ReactNode } from 'react';
4
- import { CanvasProps, ThreeElements } from '@react-three/fiber';
5
+ import { ThreeElements } from '@react-three/fiber';
5
6
  import * as THREE from 'three';
6
7
 
7
- /**
8
- * @license
9
- * SPDX-License-Identifier: Apache-2.0
10
- */
11
-
12
- /**
13
- * Module augmentation interface for type-safe resource names.
14
- *
15
- * Declare your model's resource names via module augmentation:
16
- * ```ts
17
- * declare module 'mujoco-react' {
18
- * interface Register {
19
- * robots: {
20
- * panda: {
21
- * actuators: 'joint1' | 'joint2' | 'gripper';
22
- * sensors: 'force_sensor' | 'torque_sensor';
23
- * bodies: 'link0' | 'link1' | 'hand';
24
- * };
25
- * };
26
- * actuators: 'joint1' | 'joint2' | 'gripper';
27
- * sensors: 'force_sensor' | 'torque_sensor';
28
- * bodies: 'link0' | 'link1' | 'hand';
29
- * }
30
- * }
31
- * ```
32
- *
33
- * When no augmentation is declared, all names fall back to `string`.
34
- */
35
- interface Register {
36
- }
37
- type RegisteredRobotMap = Register extends {
38
- robots: infer T extends Record<string, Record<string, string>>;
39
- } ? T : never;
40
- type Robots = [RegisteredRobotMap] extends [never] ? string : Extract<keyof RegisteredRobotMap, string>;
41
- type RobotResource<TRobot extends string, TKey extends string> = [
42
- RegisteredRobotMap
43
- ] extends [never] ? string : TRobot extends keyof RegisteredRobotMap ? TKey extends keyof RegisteredRobotMap[TRobot] ? RegisteredRobotMap[TRobot][TKey] : string : never;
44
- type RegisterResourceKey = 'actuators' | 'sensors' | 'bodies' | 'joints' | 'sites' | 'geoms' | 'keyframes';
45
- type RobotResourceObject<TRobot extends string, TKey extends RegisterResourceKey> = string extends RobotResource<TRobot, TKey> ? Record<string, string> : {
46
- readonly [K in RobotResource<TRobot, TKey>]: K;
47
- };
48
- type RobotResourceCategory<TKey extends RegisterResourceKey> = string extends Robots ? Record<string, Record<string, string>> : {
49
- readonly [TRobot in Robots]: RobotResourceObject<TRobot, TKey>;
50
- };
51
- type RobotResourceRegistry = string extends Robots ? Record<string, Record<RegisterResourceKey, Record<string, string>>> : {
52
- readonly [TRobot in Robots]: {
53
- readonly [TKey in RegisterResourceKey]: RobotResourceObject<TRobot, TKey>;
54
- };
55
- };
56
- type RuntimeRobotResourceRegistration = Readonly<Record<string, Readonly<Record<RegisterResourceKey, Readonly<Record<string, string>>>>>>;
57
- declare function registerRobotResources(resources: RuntimeRobotResourceRegistration): void;
58
- declare const RobotResources: RobotResourceRegistry;
59
- type RobotActuators<TRobot extends string> = RobotResource<TRobot, 'actuators'>;
60
- declare const RobotActuators: RobotResourceCategory<'actuators'>;
61
- type RobotSensors<TRobot extends string> = RobotResource<TRobot, 'sensors'>;
62
- declare const RobotSensors: RobotResourceCategory<'sensors'>;
63
- type RobotBodies<TRobot extends string> = RobotResource<TRobot, 'bodies'>;
64
- declare const RobotBodies: RobotResourceCategory<'bodies'>;
65
- type RobotJoints<TRobot extends string> = RobotResource<TRobot, 'joints'>;
66
- declare const RobotJoints: RobotResourceCategory<'joints'>;
67
- type RobotSites<TRobot extends string> = RobotResource<TRobot, 'sites'>;
68
- declare const RobotSites: RobotResourceCategory<'sites'>;
69
- type RobotGeoms<TRobot extends string> = RobotResource<TRobot, 'geoms'>;
70
- declare const RobotGeoms: RobotResourceCategory<'geoms'>;
71
- type RobotKeyframes<TRobot extends string> = RobotResource<TRobot, 'keyframes'>;
72
- declare const RobotKeyframes: RobotResourceCategory<'keyframes'>;
73
- type Actuators = Register extends {
74
- actuators: infer T extends string;
75
- } ? T : string;
76
- type Sensors = Register extends {
77
- sensors: infer T extends string;
78
- } ? T : string;
79
- type Bodies = Register extends {
80
- bodies: infer T extends string;
81
- } ? T : string;
82
- type Joints = Register extends {
83
- joints: infer T extends string;
84
- } ? T : string;
85
- type Sites = Register extends {
86
- sites: infer T extends string;
87
- } ? T : string;
88
- type Geoms = Register extends {
89
- geoms: infer T extends string;
90
- } ? T : string;
91
- type Keyframes = Register extends {
92
- keyframes: infer T extends string;
93
- } ? T : string;
94
- /**
95
- * A single MuJoCo contact from the WASM module.
96
- * Accessed via `data.contact.get(i)`.
97
- */
98
- interface MujocoContact {
99
- geom1: number;
100
- geom2: number;
101
- pos: Float64Array;
102
- frame: Float64Array;
103
- dist: number;
104
- }
105
- /**
106
- * WASM contact array — supports indexed access via `.get(i)`.
107
- */
108
- interface MujocoContactArray {
109
- get(i: number): MujocoContact | undefined;
110
- delete?: () => void;
111
- }
112
- /**
113
- * Read a single contact from an already-acquired WASM contact array.
114
- * Returns undefined if the access fails (WASM heap issue, bad index, etc.).
115
- */
116
- declare function getContact(contacts: MujocoContactArray, i: number): MujocoContact | undefined;
117
- /**
118
- * Minimal interface for MuJoCo Model to avoid 'any'.
119
- */
120
- interface MujocoModel {
121
- nbody: number;
122
- ngeom: number;
123
- nsite: number;
124
- nu: number;
125
- njnt: number;
126
- nq: number;
127
- nv: number;
128
- nkey: number;
129
- nsensor: number;
130
- nsensordata: number;
131
- nlight: number;
132
- ntendon: number;
133
- nflex: number;
134
- nmesh: number;
135
- nmat: number;
136
- names: Int8Array;
137
- name_bodyadr: Int32Array;
138
- name_jntadr: Int32Array;
139
- name_geomadr: Int32Array;
140
- name_siteadr: Int32Array;
141
- name_actuatoradr: Int32Array;
142
- name_keyadr: Int32Array;
143
- name_sensoradr: Int32Array;
144
- name_tendonadr: Int32Array;
145
- body_mass: Float64Array;
146
- body_parentid: Int32Array;
147
- body_jntnum: Int32Array;
148
- body_jntadr: Int32Array;
149
- body_pos: Float64Array;
150
- body_quat: Float64Array;
151
- body_geomnum: Int32Array;
152
- body_geomadr: Int32Array;
153
- body_inertia: Float64Array;
154
- qpos0: Float64Array;
155
- jnt_qposadr: Int32Array;
156
- jnt_dofadr: Int32Array;
157
- jnt_type: Int32Array;
158
- jnt_range: Float64Array;
159
- jnt_bodyid: Int32Array;
160
- jnt_pos: Float64Array;
161
- jnt_axis: Float64Array;
162
- jnt_limited: Uint8Array;
163
- geom_group: Int32Array;
164
- geom_type: Int32Array;
165
- geom_size: Float64Array;
166
- geom_pos: Float64Array;
167
- geom_quat: Float64Array;
168
- geom_matid: Int32Array;
169
- geom_rgba: Float32Array;
170
- geom_dataid: Int32Array;
171
- geom_bodyid: Int32Array;
172
- geom_contype: Int32Array;
173
- geom_conaffinity: Int32Array;
174
- geom_friction: Float64Array;
175
- mat_rgba: Float32Array;
176
- mesh_vertadr: Int32Array;
177
- mesh_vertnum: Int32Array;
178
- mesh_faceadr: Int32Array;
179
- mesh_facenum: Int32Array;
180
- mesh_vert: Float32Array;
181
- mesh_face: Int32Array;
182
- mesh_normal: Float32Array;
183
- site_bodyid: Int32Array;
184
- actuator_trnid: Int32Array;
185
- actuator_ctrlrange: Float64Array;
186
- actuator_trntype: Int32Array;
187
- actuator_gainprm: Float64Array;
188
- actuator_biasprm: Float64Array;
189
- sensor_type: Int32Array;
190
- sensor_dim: Int32Array;
191
- sensor_adr: Int32Array;
192
- sensor_objtype: Int32Array;
193
- sensor_objid: Int32Array;
194
- key_qpos: Float64Array;
195
- key_ctrl: Float64Array;
196
- key_time: Float64Array;
197
- key_qvel: Float64Array;
198
- light_pos: Float64Array;
199
- light_dir: Float64Array;
200
- light_diffuse: Float32Array;
201
- light_specular: Float32Array;
202
- light_type: Int32Array;
203
- light_active: Uint8Array;
204
- light_castshadow: Uint8Array;
205
- light_attenuation: Float32Array;
206
- light_cutoff: Float32Array;
207
- light_exponent: Float32Array;
208
- light_intensity: Float32Array;
209
- ten_wrapadr: Int32Array;
210
- ten_wrapnum: Int32Array;
211
- ten_range: Float64Array;
212
- ten_rgba: Float32Array;
213
- ten_width: Float64Array;
214
- flex_vertadr: Int32Array;
215
- flex_vertnum: Int32Array;
216
- flex_faceadr: Int32Array;
217
- flex_facenum: Int32Array;
218
- flex_face: Int32Array;
219
- flex_rgba: Float32Array;
220
- opt: {
221
- timestep: number;
222
- gravity: Float64Array;
223
- integrator: number;
224
- [key: string]: unknown;
225
- };
226
- delete: () => void;
227
- [key: string]: unknown;
228
- }
229
- /**
230
- * Minimal interface for MuJoCo Data to avoid 'any'.
231
- */
232
- interface MujocoData {
233
- time: number;
234
- qpos: Float64Array;
235
- qvel: Float64Array;
236
- ctrl: Float64Array;
237
- act: Float64Array;
238
- xpos: Float64Array;
239
- xquat: Float64Array;
240
- xfrc_applied: Float64Array;
241
- qfrc_applied: Float64Array;
242
- qfrc_bias: Float64Array;
243
- site_xpos: Float64Array;
244
- site_xmat: Float64Array;
245
- sensordata: Float64Array;
246
- ncon: number;
247
- contact: MujocoContactArray;
248
- cvel: Float64Array;
249
- cfrc_ext: Float64Array;
250
- ten_length: Float64Array;
251
- wrap_xpos: Float64Array;
252
- ten_wrapadr: Int32Array;
253
- flexvert_xpos: Float64Array;
254
- geom_xpos: Float64Array;
255
- geom_xmat: Float64Array;
256
- delete: () => void;
257
- [key: string]: unknown;
258
- }
259
- /**
260
- * Minimal interface for the MuJoCo WASM Module.
261
- */
262
- interface MujocoModule {
263
- MjModel: {
264
- from_xml_path?: (path: string) => MujocoModel;
265
- from_xml_string?: (xml: string, vfs?: unknown) => MujocoModel;
266
- loadFromXML?: (path: string) => MujocoModel;
267
- [key: string]: unknown;
268
- };
269
- MjData: new (model: MujocoModel) => MujocoData;
270
- MjvOption: new () => {
271
- delete: () => void;
272
- [key: string]: unknown;
273
- };
274
- mj_forward: (m: MujocoModel, d: MujocoData) => void;
275
- mj_step: (m: MujocoModel, d: MujocoData) => void;
276
- mj_resetData: (m: MujocoModel, d: MujocoData) => void;
277
- mj_step1: (m: MujocoModel, d: MujocoData) => void;
278
- mj_step2: (m: MujocoModel, d: MujocoData) => void;
279
- mj_applyFT: (model: MujocoModel, data: MujocoData, force: Float64Array, torque: Float64Array, point: Float64Array, bodyId: number, qfrc_target: Float64Array) => void;
280
- mj_ray: (model: MujocoModel, data: MujocoData, pnt: Float64Array, vec: Float64Array, geomgroup: Uint8Array | null, flg_static: number, bodyexclude: number, geomid: Int32Array) => number;
281
- mj_name2id: (model: MujocoModel, type: number, name: string) => number;
282
- mjtObj: Record<string, number>;
283
- mjtGeom: Record<string, number | {
284
- value: number;
285
- }>;
286
- mjtJoint: Record<string, number | {
287
- value: number;
288
- }>;
289
- mjtSensor: Record<string, number | {
290
- value: number;
291
- }>;
292
- FS: {
293
- writeFile: (path: string, content: string | Uint8Array) => void;
294
- readFile: (path: string, opts?: {
295
- encoding: string;
296
- }) => string | Uint8Array;
297
- mkdir: (path: string) => void;
298
- unmount: (path: string) => void;
299
- };
300
- [key: string]: unknown;
301
- }
302
- interface SceneObject {
303
- name: string;
304
- type: 'box' | 'sphere' | 'cylinder';
305
- size: [number, number, number];
306
- position: [number, number, number];
307
- rgba: [number, number, number, number];
308
- mass?: number;
309
- freejoint?: boolean;
310
- friction?: string;
311
- solref?: string;
312
- solimp?: string;
313
- condim?: 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
- homeJoints?: number[];
326
- xmlPatches?: XmlPatch[];
327
- sceneObjects?: SceneObject[];
328
- onReset?: (model: MujocoModel, data: MujocoData) => void;
329
- }
330
- interface SceneConfig {
331
- /** Base URL for fetching model files. The loader fetches `src + sceneFile` and follows dependencies. */
332
- src: string;
333
- /** Entry MJCF XML or URDF file name, e.g. 'scene.xml' or 'robot.urdf'. */
334
- sceneFile: string;
335
- /** Browser-selected files for local MJCF/URDF loading. Preserves webkitRelativePath when available. */
336
- files?: readonly LocalMujocoFile[];
337
- sceneObjects?: SceneObject[];
338
- homeJoints?: number[];
339
- xmlPatches?: XmlPatch[];
340
- onReset?: (model: MujocoModel, data: MujocoData) => void;
341
- }
342
- type ResourceSelector<TInfo, TName extends string = string> = TName | readonly TName[] | RegExp | ((info: TInfo) => boolean);
343
- interface IkConfig {
344
- /** MuJoCo site name for IK target. */
345
- siteName: Sites;
346
- /**
347
- * Explicit joints for IK. When omitted, the controller infers scalar hinge/slide
348
- * joints by walking from the site body to the model root.
349
- */
350
- joints?: ResourceSelector<JointInfo, Joints>;
351
- /** Explicit actuators for IK control output. */
352
- actuators?: ResourceSelector<ActuatorInfo, Actuators>;
353
- /**
354
- * Number of joints to solve for, assuming legacy contiguous qpos/ctrl layout
355
- * starting at index 0. Prefer inferred IK or `joints`/`actuators`.
356
- */
357
- numJoints?: number;
358
- /** Custom IK solver. When omitted, uses built-in Damped Least-Squares solver. */
359
- ikSolveFn?: IKSolveFn;
360
- /** DLS damping. Default: 0.01. */
361
- damping?: number;
362
- /** Max solver iterations. Default: 50. */
363
- maxIterations?: number;
364
- }
365
- interface IkContextValue {
366
- ikEnabledRef: React__default.RefObject<boolean>;
367
- ikCalculatingRef: React__default.RefObject<boolean>;
368
- ikTargetRef: React__default.RefObject<THREE.Group>;
369
- siteIdRef: React__default.RefObject<number>;
370
- setIkEnabled: (enabled: boolean) => void;
371
- moveTarget: (pos: THREE.Vector3, duration?: number) => void;
372
- syncTargetToSite: () => void;
373
- solveIK: (pos: THREE.Vector3, quat: THREE.Quaternion, currentQ: number[]) => number[] | null;
374
- getGizmoStats: () => {
375
- pos: THREE.Vector3;
376
- rot: THREE.Euler;
377
- } | null;
378
- }
379
- interface SceneMarker {
380
- id: number;
381
- position: THREE.Vector3;
382
- label: string;
383
- }
384
- interface PhysicsConfig {
385
- gravity?: [number, number, number];
386
- timestep?: number;
387
- substeps?: number;
388
- paused?: boolean;
389
- speed?: number;
390
- }
391
- type IKSolveFn = (pos: THREE.Vector3, quat: THREE.Quaternion, currentQ: number[], context?: IKSolveContext) => number[] | null;
392
- interface IKSolveContext {
393
- model: MujocoModel;
394
- data: MujocoData;
395
- siteId: number;
396
- controlGroup: ControlGroupInfo;
397
- }
398
- type PhysicsStepCallback = (model: MujocoModel, data: MujocoData) => void;
399
- interface StateSnapshot {
400
- time: number;
401
- qpos: Float64Array;
402
- qvel: Float64Array;
403
- ctrl: Float64Array;
404
- act: Float64Array;
405
- qfrc_applied: Float64Array;
406
- }
407
- interface BodyInfo {
408
- id: number;
409
- name: string;
410
- mass: number;
411
- parentId: number;
412
- }
413
- interface JointInfo {
414
- id: number;
415
- name: string;
416
- type: number;
417
- typeName: string;
418
- range: [number, number];
419
- limited: boolean;
420
- bodyId: number;
421
- qposAdr: number;
422
- dofAdr: number;
423
- }
424
- interface GeomInfo {
425
- id: number;
426
- name: string;
427
- type: number;
428
- typeName: string;
429
- size: [number, number, number];
430
- bodyId: number;
431
- }
432
- interface SiteInfo {
433
- id: number;
434
- name: string;
435
- bodyId: number;
436
- }
437
- interface ActuatorInfo {
438
- id: number;
439
- name: string;
440
- range: [number, number];
441
- }
442
- interface ActuatedJointInfo extends JointInfo {
443
- actuatorId: number;
444
- actuatorName: string;
445
- ctrlAdr: number;
446
- ctrlRange: [number, number];
447
- }
448
- interface ControlJointInfo extends JointInfo {
449
- actuatorId: number | null;
450
- actuatorName: string | null;
451
- ctrlAdr: number | null;
452
- ctrlRange: [number, number] | null;
453
- }
454
- interface ControlGroupSelector {
455
- /** Infer a kinematic chain from a MuJoCo site. */
456
- siteName?: Sites;
457
- /** Infer a kinematic chain from a body. */
458
- bodyName?: Bodies;
459
- /** Select joints by name, names, regex, or predicate. */
460
- joints?: ResourceSelector<JointInfo, Joints>;
461
- /** Select actuators by name, names, regex, or predicate. */
462
- actuators?: ResourceSelector<ActuatorInfo, Actuators>;
463
- }
464
- interface ControlGroupInfo {
465
- /** Joints in solve/control order. */
466
- joints: ControlJointInfo[];
467
- /** Actuators in control output order. */
468
- actuators: ActuatorInfo[];
469
- /** qpos addresses for scalar hinge/slide joints. */
470
- qposAdr: number[];
471
- /** dof addresses for scalar hinge/slide joints. */
472
- dofAdr: number[];
473
- /** ctrl addresses matching writable actuators. */
474
- ctrlAdr: number[];
475
- readQpos(data: MujocoData): Float64Array;
476
- readCtrl(data: MujocoData): Float64Array;
477
- writeQpos(data: MujocoData, values: ArrayLike<number>): void;
478
- writeCtrl(data: MujocoData, values: ArrayLike<number>): void;
479
- }
480
- interface SensorInfo {
481
- id: number;
482
- name: string;
483
- type: number;
484
- typeName: string;
485
- dim: number;
486
- adr: number;
487
- }
488
- interface ContactInfo {
489
- geom1: number;
490
- geom1Name: string;
491
- geom2: number;
492
- geom2Name: string;
493
- pos: [number, number, number];
494
- depth: number;
495
- }
496
- interface RayHit {
497
- point: THREE.Vector3;
498
- bodyId: number;
499
- geomId: number;
500
- distance: number;
501
- }
502
- interface ModelOptions {
503
- timestep: number;
504
- gravity: [number, number, number];
505
- integrator: number;
506
- }
507
- interface TrajectoryFrame {
508
- time: number;
509
- qpos: Float64Array;
510
- qvel?: Float64Array;
511
- ctrl?: Float64Array;
512
- sensordata?: Float64Array;
513
- }
514
- interface TrajectoryData {
515
- frames: TrajectoryFrame[];
516
- fps: number;
517
- }
518
- type PlaybackState = 'idle' | 'playing' | 'paused' | 'completed';
519
- interface KeyBinding {
520
- actuator: Actuators;
521
- delta?: number;
522
- toggle?: [number, number];
523
- set?: number;
524
- }
525
- interface KeyboardTeleopConfig {
526
- bindings: Record<string, KeyBinding>;
527
- enabled?: boolean;
528
- }
529
- interface PolicyConfig {
530
- frequency: number;
531
- onObservation: (model: MujocoModel, data: MujocoData) => Float32Array | Float64Array | number[];
532
- onAction: (action: Float32Array | Float64Array | number[], model: MujocoModel, data: MujocoData) => void;
533
- }
534
- type ObservationOutput = 'float32' | 'float64';
535
- interface ObservationConfig {
536
- /** Include scalar simulation time. */
537
- time?: boolean;
538
- /** Include all qpos values. */
539
- qpos?: boolean;
540
- /** Include all qvel values. */
541
- qvel?: boolean;
542
- /** Include all ctrl values. */
543
- ctrl?: boolean;
544
- /** Include all actuator activation values. */
545
- act?: boolean;
546
- /** Include all raw sensordata values. */
547
- sensordata?: boolean;
548
- /** Include named sensor values in the configured order. */
549
- sensors?: readonly Sensors[];
550
- /** Include named site world positions in the configured order. */
551
- sites?: readonly Sites[];
552
- /** Include world gravity projected into each named body's local frame. */
553
- projectedGravity?: Bodies | readonly Bodies[];
554
- /** Output array type. Defaults to Float32Array. */
555
- output?: ObservationOutput;
556
- }
557
- interface ObservationLayoutItem {
558
- name: string;
559
- start: number;
560
- size: number;
561
- }
562
- interface ObservationResult {
563
- values: Float32Array | Float64Array;
564
- layout: ObservationLayoutItem[];
565
- }
566
- interface ObservationHandle {
567
- /** Read a fresh observation from the current live MuJoCo model/data refs. */
568
- read(): ObservationResult;
569
- /** Read just the vector values for policy inference. */
570
- readValues(): Float32Array | Float64Array;
571
- }
572
- interface DebugProps {
573
- showGeoms?: boolean;
574
- showSites?: boolean;
575
- showJoints?: boolean;
576
- showContacts?: boolean;
577
- showCOM?: boolean;
578
- showInertia?: boolean;
579
- showTendons?: boolean;
580
- }
581
- interface IkGizmoProps {
582
- controller: IkContextValue;
583
- siteName?: string;
584
- scale?: number;
585
- onDrag?: (position: THREE.Vector3, quaternion: THREE.Quaternion) => void;
586
- }
587
- interface DragInteractionProps {
588
- stiffness?: number;
589
- showArrow?: boolean;
590
- }
591
- interface SceneLightsProps {
592
- /** Override intensity for all MJCF lights. Default: 1.0. */
593
- intensity?: number;
594
- }
595
- type TrajectoryInput = TrajectoryFrame[] | number[][];
596
- interface TrajectoryPlayerProps {
597
- trajectory: TrajectoryInput;
598
- fps?: number;
599
- speed?: number;
600
- loop?: boolean;
601
- playing?: boolean;
602
- mode?: 'kinematic' | 'physics';
603
- onFrame?: (frameIdx: number) => void;
604
- onComplete?: () => void;
605
- onStateChange?: (state: PlaybackState) => void;
606
- }
607
- interface ContactListenerProps {
608
- body: Bodies;
609
- onContactEnter?: (info: ContactInfo) => void;
610
- onContactExit?: (info: ContactInfo) => void;
611
- }
612
- interface BodyProps {
613
- name: Bodies;
614
- type: 'box' | 'sphere' | 'cylinder';
615
- size: [number, number, number];
616
- position?: [number, number, number];
617
- rgba?: [number, number, number, number];
618
- mass?: number;
619
- freejoint?: boolean;
620
- friction?: string;
621
- solref?: string;
622
- solimp?: string;
623
- condim?: number;
624
- children?: ReactNode;
625
- }
626
- interface MujocoSimAPI {
627
- readonly status: 'loading' | 'ready' | 'error';
628
- readonly config: SceneConfig;
629
- reset(): void;
630
- setSpeed(multiplier: number): void;
631
- togglePause(): boolean;
632
- setPaused(paused: boolean): void;
633
- step(n?: number): void;
634
- getTime(): number;
635
- getTimestep(): number;
636
- applyKeyframe(nameOrIndex: Keyframes | number): void;
637
- saveState(): StateSnapshot;
638
- restoreState(snapshot: StateSnapshot): void;
639
- setQpos(values: Float64Array | number[]): void;
640
- setQvel(values: Float64Array | number[]): void;
641
- getQpos(): Float64Array;
642
- getQvel(): Float64Array;
643
- setCtrl(nameOrValues: Actuators | Record<Actuators, number>, value?: number): void;
644
- getCtrl(): Float64Array;
645
- getControlMap(): ControlGroupInfo;
646
- getActuatedJoints(): ActuatedJointInfo[];
647
- resolveControlGroup(selector: ControlGroupSelector): ControlGroupInfo | null;
648
- applyForce(bodyName: Bodies, force: THREE.Vector3, point?: THREE.Vector3): void;
649
- applyTorque(bodyName: Bodies, torque: THREE.Vector3): void;
650
- setExternalForce(bodyName: Bodies, force: THREE.Vector3, torque: THREE.Vector3): void;
651
- applyGeneralizedForce(values: Float64Array | number[]): void;
652
- getSensorData(name: Sensors): Float64Array | null;
653
- getContacts(): ContactInfo[];
654
- getBodies(): BodyInfo[];
655
- getJoints(): JointInfo[];
656
- getGeoms(): GeomInfo[];
657
- getSites(): SiteInfo[];
658
- getActuators(): ActuatorInfo[];
659
- getSensors(): SensorInfo[];
660
- getModelOption(): ModelOptions;
661
- setGravity(g: [number, number, number]): void;
662
- setTimestep(dt: number): void;
663
- raycast(origin: THREE.Vector3, direction: THREE.Vector3, maxDist?: number): RayHit | null;
664
- getKeyframeNames(): string[];
665
- getKeyframeCount(): number;
666
- loadScene(newConfig: SceneConfig): Promise<void>;
667
- loadFromFiles(files: FileList | readonly LocalMujocoFile[], options?: LoadFromFilesOptions): Promise<void>;
668
- addBody(body: SceneObject): Promise<void>;
669
- removeBody(name: Bodies): Promise<void>;
670
- recompile(patches?: XmlPatch[]): Promise<void>;
671
- getCanvasSnapshot(width?: number, height?: number, mimeType?: string): string;
672
- project2DTo3D(x: number, y: number, cameraPos: THREE.Vector3, lookAt: THREE.Vector3): {
673
- point: THREE.Vector3;
674
- bodyId: number;
675
- geomId: number;
676
- } | null;
677
- setBodyMass(name: Bodies, mass: number): void;
678
- setGeomFriction(name: Geoms, friction: [number, number, number]): void;
679
- setGeomSize(name: Geoms, size: [number, number, number]): void;
680
- readonly mjModelRef: React__default.RefObject<MujocoModel | null>;
681
- readonly mjDataRef: React__default.RefObject<MujocoData | null>;
682
- }
683
- type MujocoCanvasProps = Omit<CanvasProps, 'onError'> & {
684
- config: SceneConfig;
685
- onReady?: (api: MujocoSimAPI) => void;
686
- onError?: (error: Error) => void;
687
- onStep?: (time: number) => void;
688
- onSelection?: (bodyId: number, name: string) => void;
689
- gravity?: [number, number, number];
690
- timestep?: number;
691
- substeps?: number;
692
- paused?: boolean;
693
- speed?: number;
694
- interpolate?: boolean;
695
- };
696
- interface SitePositionResult {
697
- position: React__default.RefObject<THREE.Vector3>;
698
- quaternion: React__default.RefObject<THREE.Quaternion>;
699
- }
700
- interface MujocoContextValue {
701
- mujoco: MujocoModule | null;
702
- status: 'loading' | 'ready' | 'error';
703
- error: string | null;
704
- }
705
- /** @deprecated Use `SensorHandle` instead. */
706
- interface SensorResult {
707
- value: React__default.RefObject<Float64Array>;
708
- size: number;
709
- }
710
- interface CtrlHandle {
711
- /** Read the current ctrl value. */
712
- read(): number;
713
- /** Write a ctrl value (goes directly to data.ctrl). */
714
- write(value: number): void;
715
- /** Actuator name. */
716
- name: Actuators;
717
- /** Actuator control range [min, max]. */
718
- range: [number, number];
719
- }
720
- interface SensorHandle {
721
- /** Read the current sensor data. */
722
- read(): Float64Array;
723
- /** Sensor dimensionality. */
724
- dim: number;
725
- /** Sensor name. */
726
- name: Sensors;
727
- }
728
- interface BodyStateResult {
729
- position: React__default.RefObject<THREE.Vector3>;
730
- quaternion: React__default.RefObject<THREE.Quaternion>;
731
- linearVelocity: React__default.RefObject<THREE.Vector3>;
732
- angularVelocity: React__default.RefObject<THREE.Vector3>;
733
- }
734
- interface JointStateResult {
735
- position: React__default.RefObject<number | Float64Array>;
736
- velocity: React__default.RefObject<number | Float64Array>;
737
- }
738
-
739
8
  /**
740
9
  * Hook to access the MuJoCo WASM module.
741
10
  */
@@ -1091,6 +360,39 @@ declare function DragInteraction({ stiffness, showArrow, ...groupProps }: DragIn
1091
360
 
1092
361
  declare function SceneLights({ intensity }: SceneLightsProps): null;
1093
362
 
363
+ declare function ScenarioLighting({ preset, castShadow, intensity, }: ScenarioLightingProps): react_jsx_runtime.JSX.Element;
364
+ declare function getScenarioBackground(preset: ScenarioLightingPreset | undefined, fallback?: string): string;
365
+ declare function getScenarioCameraPosition(basePosition: readonly [number, number, number], scenario?: Pick<VisualScenarioConfig, 'camera'>): [number, number, number];
366
+ /**
367
+ * Renderer-agnostic Gaussian splat environment boundary.
368
+ *
369
+ * This component intentionally does not import a specific 3DGS renderer. Pass a
370
+ * Spark/GaussianSplats3D object as `children` once the app chooses a renderer,
371
+ * and pass MuJoCo/MJCF collision proxy visuals via `collisionProxy`.
372
+ */
373
+ declare function SplatEnvironment({ environment, src, format, collisionProxy, collisionProxyMetadata, children, showPlaceholder, ...groupProps }: SplatEnvironmentProps): react_jsx_runtime.JSX.Element;
374
+ declare function useSplatEnvironment({ environment, src, format, collisionProxy, }: SplatEnvironmentMetadataInput): SplatEnvironmentMetadata;
375
+ declare function createSplatEnvironmentUserData({ environment, src, format, collisionProxy, }: {
376
+ environment?: PairedSplatEnvironmentConfig;
377
+ src?: string;
378
+ format?: SplatFormat;
379
+ collisionProxy?: SplatCollisionProxyConfig;
380
+ }): {
381
+ role: string;
382
+ environmentId: string | undefined;
383
+ environmentLabel: string | undefined;
384
+ splatSrc: string | undefined;
385
+ splatFormat: SplatFormat;
386
+ splatRenderer: SplatRendererKind | undefined;
387
+ collisionProxyStatus: "missing" | "planned" | "generated" | "validated";
388
+ collisionProxyXmlPath: string | undefined;
389
+ collisionProxyPrimitives: SplatCollisionPrimitive[];
390
+ };
391
+ declare function createSparkSplatViewerUrl({ viewerUrl, splatSrc, }: {
392
+ viewerUrl: string;
393
+ splatSrc: string;
394
+ }): string;
395
+
1094
396
  /**
1095
397
  * Declarative debug visualization component.
1096
398
  * Renders wireframe geoms, site markers, joint axes, contact forces, COM markers, etc.
@@ -1526,4 +828,4 @@ interface CameraAnimationAPI {
1526
828
  */
1527
829
  declare function useCameraAnimation(): CameraAnimationAPI;
1528
830
 
1529
- 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, InstancedGeomRenderer, 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 ObservationConfig, type ObservationHandle, type ObservationLayoutItem, type ObservationOutput, type ObservationResult, type PhysicsConfig, type PhysicsStepCallback, type PlaybackState, type PolicyConfig, type RayHit, type Register, type RegisteredRobotMap, type ResourceSelector, RobotActuators, RobotBodies, RobotGeoms, RobotJoints, RobotKeyframes, type RobotResource, RobotResources, RobotSensors, RobotSites, type Robots, 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, buildObservation, createContiguousControlGroup, createController, createControllerHook, findActuatorByName, findBodyByName, findGeomByName, findJointByName, findKeyframeByName, findSensorByName, findSiteByName, findTendonByName, getActuatedJoints, getContact, getControlMap, getName, loadScene, registerRobotResources, resolveControlGroup, useActuators, useAfterPhysicsStep, useBeforePhysicsStep, useBodyMeshes, useBodyState, useCameraAnimation, useContactEvents, useContacts, useCtrl, useCtrlNoise, useGamepad, useGravityCompensation, useIkController, useJointState, useKeyboardTeleop, useMujoco, useMujocoWasm, useObservation, usePolicy, useSceneLights, useSelectionHighlight, useSensor, useSensors, useSitePosition, useTrajectoryPlayer, useTrajectoryRecorder, useVideoRecorder };
831
+ export { ActuatedJointInfo, ActuatorInfo, Actuators, Bodies, Body, BodyProps, BodyStateResult, type CameraAnimationAPI, ContactInfo, ContactListener, ContactListenerProps, ContactMarkers, ControlGroupInfo, ControlGroupSelector, type ControllerComponent, type ControllerOptions, CtrlHandle, Debug, DebugProps, DragInteraction, DragInteractionProps, FlexRenderer, GeomInfo, IkConfig, IkContextValue, IkGizmo, IkGizmoProps, InstancedGeomRenderer, JointStateResult, Joints, KeyboardTeleopConfig, MujocoCanvas, MujocoCanvasProps, MujocoContextValue, MujocoData, type MujocoLoader, type MujocoLoaderOptions, MujocoModel, MujocoModule, MujocoPhysics, type MujocoPhysicsProps, MujocoProvider, type MujocoProviderProps, MujocoSimAPI, MujocoSimProvider, type MujocoWasmVariant, ObservationConfig, ObservationHandle, ObservationResult, PairedSplatEnvironmentConfig, PhysicsStepCallback, PlaybackState, PolicyConfig, ScenarioLighting, ScenarioLightingPreset, ScenarioLightingProps, SceneConfig, SceneLights, SceneLightsProps, SensorHandle, SensorInfo, Sensors, SitePositionResult, Sites, SplatCollisionPrimitive, SplatCollisionProxyConfig, SplatEnvironment, SplatEnvironmentMetadata, SplatEnvironmentMetadataInput, SplatEnvironmentProps, SplatFormat, SplatRendererKind, TendonRenderer, TrajectoryFrame, TrajectoryInput, TrajectoryPlayer, TrajectoryPlayerProps, VisualScenarioConfig, buildObservation, createContiguousControlGroup, createController, createControllerHook, createSparkSplatViewerUrl, createSplatEnvironmentUserData, findActuatorByName, findBodyByName, findGeomByName, findJointByName, findKeyframeByName, findSensorByName, findSiteByName, findTendonByName, getActuatedJoints, getControlMap, getName, getScenarioBackground, getScenarioCameraPosition, loadScene, resolveControlGroup, useActuators, useAfterPhysicsStep, useBeforePhysicsStep, useBodyMeshes, useBodyState, useCameraAnimation, useContactEvents, useContacts, useCtrl, useCtrlNoise, useGamepad, useGravityCompensation, useIkController, useJointState, useKeyboardTeleop, useMujoco, useMujocoWasm, useObservation, usePolicy, useSceneLights, useSelectionHighlight, useSensor, useSensors, useSitePosition, useSplatEnvironment, useTrajectoryPlayer, useTrajectoryRecorder, useVideoRecorder };