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
package/dist/index.d.ts
CHANGED
|
@@ -1,741 +1,11 @@
|
|
|
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, V as VisualScenarioEffectsProps, m as VisualScenarioConfig, n as SplatRendererKind, o as PairedSplatEnvironmentConfig, p as SplatFormat, q as SplatCollisionProxyConfig, r as SplatCollisionPrimitive, s as ScenarioLightingPreset, t as SplatEnvironmentMetadataInput, u as SplatEnvironmentMetadata, v as SplatSceneInput, w as DebugProps, G as GeomInfo, x as ContactListenerProps, T as TrajectoryPlayerProps, y as ActuatorInfo, z as Sites, E as SitePositionResult, F as Sensors, H as SensorHandle, J as SensorInfo, K as Joints, L as JointStateResult, N as Bodies, Q as BodyStateResult, R as Actuators, U as CtrlHandle, W as ContactInfo, X as KeyboardTeleopConfig, Y as PolicyConfig, Z as PolicyVector, _ as ObservationHandle, $ as TrajectoryInput, a0 as PlaybackState, a1 as TrajectoryFrame } from './types-BmneHLBM.js';
|
|
3
|
+
export { a2 as BodyInfo, a3 as ControlJointInfo, a4 as Geoms, a5 as IKSolveFn, a6 as JointInfo, a7 as KeyBinding, a8 as Keyframes, a9 as ModelOptions, aa as MujocoContact, ab as MujocoContactArray, ac as ObservationLayoutItem, ad as ObservationOutput, ae as PhysicsConfig, af as PolicyActionInput, ag as PolicyInferenceInput, ah as PolicyObservationInput, ai as RayHit, aj as Register, ak as RegisteredRobotMap, al as ResourceSelector, am as RobotActuators, an as RobotBodies, ao as RobotGeoms, ap as RobotJoints, aq as RobotKeyframes, ar as RobotResource, as as RobotResources, at as RobotSensors, au as RobotSites, av as Robots, aw as ScenarioCameraConfig, ax as ScenarioMaterialConfig, ay as SceneMarker, az as SceneObject, aA as SensorResult, aB as SiteInfo, aC as SplatAssetConfig, aD as SplatScenarioConfig, aE as StateSnapshot, aF as TrajectoryData, aG as XmlPatch, aH as getContact, aI as registerRobotResources } from './types-BmneHLBM.js';
|
|
2
4
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default
|
|
4
|
-
import {
|
|
5
|
+
import React__default from 'react';
|
|
6
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
5
7
|
import * as THREE from 'three';
|
|
6
8
|
|
|
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
9
|
/**
|
|
740
10
|
* Hook to access the MuJoCo WASM module.
|
|
741
11
|
*/
|
|
@@ -1031,7 +301,7 @@ declare const useIkController: (config: IkConfig | null) => IkContextValue | nul
|
|
|
1031
301
|
* runs before the provider's loadScene useEffect). Bodies added/removed after
|
|
1032
302
|
* the initial load trigger a debounced scene reload.
|
|
1033
303
|
*/
|
|
1034
|
-
declare function Body({ name, type, size, position, rgba, mass, freejoint, friction, solref, solimp, condim, children, }: BodyProps): react_jsx_runtime.JSX.Element | null;
|
|
304
|
+
declare function Body({ name, type, size, position, rgba, mass, freejoint, friction, solref, solimp, condim, group, children, }: BodyProps): react_jsx_runtime.JSX.Element | null;
|
|
1035
305
|
|
|
1036
306
|
/**
|
|
1037
307
|
* IkGizmo — drei PivotControls that tracks a MuJoCo site.
|
|
@@ -1091,6 +361,62 @@ declare function DragInteraction({ stiffness, showArrow, ...groupProps }: DragIn
|
|
|
1091
361
|
|
|
1092
362
|
declare function SceneLights({ intensity }: SceneLightsProps): null;
|
|
1093
363
|
|
|
364
|
+
declare function ScenarioLighting({ preset, castShadow, intensity, }: ScenarioLightingProps): react_jsx_runtime.JSX.Element;
|
|
365
|
+
declare function getScenarioBackground(preset: ScenarioLightingPreset | undefined, fallback?: string): string;
|
|
366
|
+
declare function getScenarioCameraPosition(basePosition: readonly [number, number, number], scenario?: Pick<VisualScenarioConfig, 'camera'>): [number, number, number];
|
|
367
|
+
declare function VisualScenarioEffects(props: VisualScenarioEffectsProps): null;
|
|
368
|
+
declare function useVisualScenarioEffects({ scenario, enabled, applyBackground, applyFog, applyRenderer, applyMaterials, background, fogNear, fogFar, materialFilter, }: VisualScenarioEffectsProps): void;
|
|
369
|
+
/**
|
|
370
|
+
* Renderer-agnostic Gaussian splat environment boundary.
|
|
371
|
+
*
|
|
372
|
+
* This component intentionally does not import a specific 3DGS renderer. Pass a
|
|
373
|
+
* Spark/GaussianSplats3D object as `children` once the app chooses a renderer,
|
|
374
|
+
* and pass MuJoCo/MJCF collision proxy visuals via `collisionProxy`.
|
|
375
|
+
*/
|
|
376
|
+
declare function SplatEnvironment({ environment, scenario, renderer, src, format, collisionProxy, collisionProxyMetadata, children, showPlaceholder, ...groupProps }: SplatEnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
377
|
+
declare function useSplatEnvironment({ environment, scenario, renderer, src, format, collisionProxy, }: SplatEnvironmentMetadataInput): SplatEnvironmentMetadata;
|
|
378
|
+
/**
|
|
379
|
+
* Convert a generic visual scenario splat block into a paired visual/physics
|
|
380
|
+
* environment config. Returns undefined until both the splat asset and MJCF
|
|
381
|
+
* collision proxy are present.
|
|
382
|
+
*/
|
|
383
|
+
declare function createPairedSplatEnvironment(scenario: Pick<VisualScenarioConfig, 'id' | 'label' | 'environment' | 'splat'>, options?: {
|
|
384
|
+
id?: string;
|
|
385
|
+
label?: string;
|
|
386
|
+
description?: string;
|
|
387
|
+
renderer?: SplatRendererKind;
|
|
388
|
+
}): PairedSplatEnvironmentConfig | undefined;
|
|
389
|
+
/**
|
|
390
|
+
* Compose a MuJoCo scene config with a paired splat collision proxy.
|
|
391
|
+
*
|
|
392
|
+
* This keeps the common hybrid setup declarative:
|
|
393
|
+
* robot XML remains `sceneFile`, the `.spz` remains a visual-only layer, and
|
|
394
|
+
* the paired MJCF collision proxy is added to `environmentFiles`.
|
|
395
|
+
*/
|
|
396
|
+
declare function withSplatEnvironment(sceneConfig: SceneConfig, input: SplatSceneInput, options?: {
|
|
397
|
+
renderer?: SplatRendererKind;
|
|
398
|
+
}): SceneConfig;
|
|
399
|
+
declare function createSplatEnvironmentUserData({ environment, src, format, collisionProxy, }: {
|
|
400
|
+
environment?: PairedSplatEnvironmentConfig;
|
|
401
|
+
src?: string;
|
|
402
|
+
format?: SplatFormat;
|
|
403
|
+
collisionProxy?: SplatCollisionProxyConfig;
|
|
404
|
+
}): {
|
|
405
|
+
role: string;
|
|
406
|
+
environmentId: string | undefined;
|
|
407
|
+
environmentLabel: string | undefined;
|
|
408
|
+
splatSrc: string | undefined;
|
|
409
|
+
splatFormat: SplatFormat;
|
|
410
|
+
splatRenderer: SplatRendererKind | undefined;
|
|
411
|
+
collisionProxyStatus: "missing" | "planned" | "generated" | "validated";
|
|
412
|
+
collisionProxyXmlPath: string | undefined;
|
|
413
|
+
collisionProxyPrimitives: SplatCollisionPrimitive[];
|
|
414
|
+
};
|
|
415
|
+
declare function createSparkSplatViewerUrl({ viewerUrl, splatSrc, }: {
|
|
416
|
+
viewerUrl: string;
|
|
417
|
+
splatSrc: string;
|
|
418
|
+
}): string;
|
|
419
|
+
|
|
1094
420
|
/**
|
|
1095
421
|
* Declarative debug visualization component.
|
|
1096
422
|
* Renders wireframe geoms, site markers, joint axes, contact forces, COM markers, etc.
|
|
@@ -1285,13 +611,6 @@ declare function useContactEvents(bodyName: Bodies, handlers: {
|
|
|
1285
611
|
*/
|
|
1286
612
|
declare function useKeyboardTeleop(config: KeyboardTeleopConfig): void;
|
|
1287
613
|
|
|
1288
|
-
/**
|
|
1289
|
-
* @license
|
|
1290
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
1291
|
-
*
|
|
1292
|
-
* usePolicy — policy decimation loop hook (spec 10.1)
|
|
1293
|
-
*/
|
|
1294
|
-
|
|
1295
614
|
/**
|
|
1296
615
|
* Framework-agnostic policy execution hook.
|
|
1297
616
|
*
|
|
@@ -1306,7 +625,8 @@ declare function usePolicy(config: PolicyConfig): {
|
|
|
1306
625
|
readonly isRunning: boolean;
|
|
1307
626
|
start: () => void;
|
|
1308
627
|
stop: () => void;
|
|
1309
|
-
readonly lastObservation:
|
|
628
|
+
readonly lastObservation: PolicyVector | null;
|
|
629
|
+
readonly lastAction: Float64Array<ArrayBufferLike> | Float32Array<ArrayBufferLike> | number[] | null;
|
|
1310
630
|
};
|
|
1311
631
|
|
|
1312
632
|
/**
|
|
@@ -1431,6 +751,56 @@ declare function useVideoRecorder(options?: VideoRecorderOptions): {
|
|
|
1431
751
|
readonly recording: boolean;
|
|
1432
752
|
};
|
|
1433
753
|
|
|
754
|
+
/**
|
|
755
|
+
* @license
|
|
756
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
757
|
+
*
|
|
758
|
+
* useFrameCapture — still-frame capture for canvas-backed MuJoCo/R3F scenes.
|
|
759
|
+
*/
|
|
760
|
+
|
|
761
|
+
type FrameCaptureStatus = 'idle' | 'capturing' | 'captured' | 'error';
|
|
762
|
+
type FrameCaptureTarget = HTMLCanvasElement | HTMLElement | null | undefined;
|
|
763
|
+
type FrameCaptureTargetRef = React__default.RefObject<HTMLCanvasElement | HTMLElement | null>;
|
|
764
|
+
interface FrameCaptureOptions {
|
|
765
|
+
target?: FrameCaptureTarget | FrameCaptureTargetRef;
|
|
766
|
+
type?: string;
|
|
767
|
+
quality?: number;
|
|
768
|
+
waitForAnimationFrame?: boolean;
|
|
769
|
+
}
|
|
770
|
+
interface FrameCaptureResult {
|
|
771
|
+
canvas: HTMLCanvasElement;
|
|
772
|
+
dataUrl: string;
|
|
773
|
+
type: string;
|
|
774
|
+
}
|
|
775
|
+
interface FrameCaptureBlobResult {
|
|
776
|
+
canvas: HTMLCanvasElement;
|
|
777
|
+
blob: Blob;
|
|
778
|
+
type: string;
|
|
779
|
+
}
|
|
780
|
+
interface FrameCaptureAPI {
|
|
781
|
+
status: FrameCaptureStatus;
|
|
782
|
+
error: Error | null;
|
|
783
|
+
isCapturing: boolean;
|
|
784
|
+
capture: (options?: FrameCaptureOptions) => Promise<FrameCaptureResult>;
|
|
785
|
+
captureBlob: (options?: FrameCaptureOptions) => Promise<FrameCaptureBlobResult>;
|
|
786
|
+
reset: () => void;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Capture the current canvas frame as a data URL.
|
|
790
|
+
*
|
|
791
|
+
* For WebGL scenes, create the renderer with `preserveDrawingBuffer: true`
|
|
792
|
+
* when you need deterministic captures after the frame has presented.
|
|
793
|
+
*/
|
|
794
|
+
declare function captureFrame(options: FrameCaptureOptions): Promise<FrameCaptureResult>;
|
|
795
|
+
/**
|
|
796
|
+
* Capture the current canvas frame as a Blob.
|
|
797
|
+
*/
|
|
798
|
+
declare function captureFrameBlob(options: FrameCaptureOptions): Promise<FrameCaptureBlobResult>;
|
|
799
|
+
/**
|
|
800
|
+
* React state wrapper around `captureFrame` and `captureFrameBlob`.
|
|
801
|
+
*/
|
|
802
|
+
declare function useFrameCapture(defaultOptions?: FrameCaptureOptions): FrameCaptureAPI;
|
|
803
|
+
|
|
1434
804
|
/**
|
|
1435
805
|
* @license
|
|
1436
806
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -1526,4 +896,4 @@ interface CameraAnimationAPI {
|
|
|
1526
896
|
*/
|
|
1527
897
|
declare function useCameraAnimation(): CameraAnimationAPI;
|
|
1528
898
|
|
|
1529
|
-
export {
|
|
899
|
+
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, type FrameCaptureAPI, type FrameCaptureBlobResult, type FrameCaptureOptions, type FrameCaptureResult, type FrameCaptureStatus, type FrameCaptureTarget, type FrameCaptureTargetRef, 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, PolicyVector, ScenarioLighting, ScenarioLightingPreset, ScenarioLightingProps, SceneConfig, SceneLights, SceneLightsProps, SensorHandle, SensorInfo, Sensors, SitePositionResult, Sites, SplatCollisionPrimitive, SplatCollisionProxyConfig, SplatEnvironment, SplatEnvironmentMetadata, SplatEnvironmentMetadataInput, SplatEnvironmentProps, SplatFormat, SplatRendererKind, SplatSceneInput, TendonRenderer, TrajectoryFrame, TrajectoryInput, TrajectoryPlayer, TrajectoryPlayerProps, VisualScenarioConfig, VisualScenarioEffects, VisualScenarioEffectsProps, buildObservation, captureFrame, captureFrameBlob, createContiguousControlGroup, createController, createControllerHook, createPairedSplatEnvironment, 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, useFrameCapture, useGamepad, useGravityCompensation, useIkController, useJointState, useKeyboardTeleop, useMujoco, useMujocoWasm, useObservation, usePolicy, useSceneLights, useSelectionHighlight, useSensor, useSensors, useSitePosition, useSplatEnvironment, useTrajectoryPlayer, useTrajectoryRecorder, useVideoRecorder, useVisualScenarioEffects, withSplatEnvironment };
|