mujoco-react 3.0.0 → 4.0.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 CHANGED
@@ -27,7 +27,7 @@ import type { SceneConfig } from 'mujoco-react';
27
27
  import { OrbitControls } from '@react-three/drei';
28
28
 
29
29
  const config: SceneConfig = {
30
- robotId: 'franka_emika_panda',
30
+ modelId: 'franka_emika_panda',
31
31
  sceneFile: 'scene.xml',
32
32
  homeJoints: [1.707, -1.754, 0.003, -2.702, 0.003, 0.951, 2.490],
33
33
  };
@@ -181,22 +181,22 @@ const ikCtx = useIk({ optional: true });
181
181
  Models are loaded from any HTTP source via `SceneConfig.baseUrl`. Defaults to [MuJoCo Menagerie](https://github.com/google-deepmind/mujoco_menagerie) on GitHub.
182
182
 
183
183
  ```tsx
184
- // Menagerie robots: just set robotId
184
+ // Menagerie models: just set modelId
185
185
  const franka: SceneConfig = {
186
- robotId: 'franka_emika_panda',
186
+ modelId: 'franka_emika_panda',
187
187
  sceneFile: 'scene.xml',
188
188
  };
189
189
 
190
190
  // Any GitHub repo
191
191
  const so101: SceneConfig = {
192
- robotId: 'so101',
192
+ modelId: 'so101',
193
193
  sceneFile: 'SO101.xml',
194
194
  baseUrl: 'https://raw.githubusercontent.com/your-org/your-repo/main/models/',
195
195
  };
196
196
 
197
197
  // Self-hosted
198
198
  const custom: SceneConfig = {
199
- robotId: 'my_robot',
199
+ modelId: 'my_robot',
200
200
  sceneFile: 'robot.xml',
201
201
  baseUrl: 'http://localhost:3000/models/my_robot/',
202
202
  };
@@ -208,7 +208,7 @@ The loader fetches the scene XML, parses it for dependencies (meshes, textures,
208
208
 
209
209
  ```ts
210
210
  interface SceneConfig {
211
- robotId: string; // e.g. 'franka_emika_panda'
211
+ modelId: string; // e.g. 'franka_emika_panda'
212
212
  sceneFile: string; // Entry XML file, e.g. 'scene.xml'
213
213
  baseUrl?: string; // Base URL for fetching model files
214
214
  sceneObjects?: SceneObject[]; // Objects injected into scene XML at load time
@@ -222,7 +222,7 @@ interface SceneConfig {
222
222
 
223
223
  ```tsx
224
224
  const config: SceneConfig = {
225
- robotId: 'franka_emika_panda',
225
+ modelId: 'franka_emika_panda',
226
226
  sceneFile: 'scene.xml',
227
227
  sceneObjects: [
228
228
  { name: 'ball', type: 'sphere', size: [0.03, 0.03, 0.03],
package/dist/index.d.ts CHANGED
@@ -233,7 +233,7 @@ interface XmlPatch {
233
233
  replace?: [string, string];
234
234
  }
235
235
  interface SceneConfig {
236
- robotId: string;
236
+ modelId: string;
237
237
  sceneFile: string;
238
238
  baseUrl?: string;
239
239
  sceneObjects?: SceneObject[];
package/dist/index.js CHANGED
@@ -400,7 +400,7 @@ async function loadScene(mujoco, config, onProgress) {
400
400
  mujoco.FS.mkdir("/working");
401
401
  } catch {
402
402
  }
403
- const baseUrl = config.baseUrl || `https://raw.githubusercontent.com/google-deepmind/mujoco_menagerie/main/${config.robotId}/`;
403
+ const baseUrl = config.baseUrl || `https://raw.githubusercontent.com/google-deepmind/mujoco_menagerie/main/${config.modelId}/`;
404
404
  const downloaded = /* @__PURE__ */ new Set();
405
405
  const queue = [config.sceneFile];
406
406
  const parser = new DOMParser();