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 +7 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/SceneLoader.ts +1 -1
- package/src/types.ts +1 -1
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
|
-
|
|
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
|
|
184
|
+
// Menagerie models: just set modelId
|
|
185
185
|
const franka: SceneConfig = {
|
|
186
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
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.
|
|
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();
|