zalo / mujoco_wasm Goto Github PK
View Code? Open in Web Editor NEWThis project forked from stillonearth/mujoco-wasm
Simulate and Render MuJoCo Models in the Browser!
Home Page: https://zalo.github.io/mujoco_wasm/
License: MIT License
This project forked from stillonearth/mujoco-wasm
Simulate and Render MuJoCo Models in the Browser!
Home Page: https://zalo.github.io/mujoco_wasm/
License: MIT License
I am trying to update the libs and rebuild the project for mujoco 2.3.3 (which I checked out the relevant files from the upstream repo at https://github.com/stillonearth/MuJoCo-WASM/tree/main/lib). This is in order to use some of the latest assets from Menagerie. However, building main.genned.c
fails due to the updated libraries. Outside of the files in lib/
and include/
what are the files/folders in this repo to update in order to get the new version of mujoco to build with this project? Happy to make a PR / branch for this too if there is a need!
Here are some of the build errors I am seeing currently:
[ 50%] Building CXX object src/CMakeFiles/mujoco_wasm.dir/main.genned.cc.o
~/mujoco_wasm/src/main.genned.cc:59:43: error: no member named 'nmeshtexvert' in 'mjModel_'; did you mean 'nmeshvert'?
59 | int nmeshtexvert () const { return m->nmeshtexvert ; }
| ^~~~~~~~~~~~
| nmeshvert
~/mujoco_wasm/include/mujoco/mjmodel.h:561:7: note: 'nmeshvert' declared here
561 | int nmeshvert; // number of vertices in all meshes
| ^
~/mujoco_wasm/src/main.genned.cc:228:74: error: no member named 'nmeshtexvert' in 'mjModel_'; did you mean 'nmeshvert'?
228 | val mesh_texcoord () const { return val(typed_memory_view(m->nmeshtexvert * 2 , m->mesh_texcoord )); }
| ^~~~~~~~~~~~
| nmeshvert
~/mujoco_wasm/include/mujoco/mjmodel.h:561:7: note: 'nmeshvert' declared here
561 | int nmeshvert; // number of vertices in all meshes
| ^
~/mujoco_wasm/src/main.genned.cc:644:91: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
644 | void _error (std::string msg ) { return mju_error (msg.c_str() ); }
| ^~~~~~~~~~~
~/mujoco_wasm/src/main.genned.cc:644:91: note: treat the string as an argument to avoid this
644 | void _error (std::string msg ) { return mju_error (msg.c_str() ); }
| ^
| "%s",
~/mujoco_wasm/src/main.genned.cc:647:91: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
647 | void _warning (std::string msg ) { return mju_warning (msg.c_str() ); }
| ^~~~~~~~~~~
~/mujoco_wasm/src/main.genned.cc:647:91: note: treat the string as an argument to avoid this
647 | void _warning (std::string msg ) { return mju_warning (msg.c_str() ); }
| ^
| "%s",
~/mujoco_wasm/src/main.genned.cc:1584:39: error: no member named 'inteval' in 'mjLROpt_'; did you mean 'interval'?
1584 | .field("inteval" , &mjLROpt::inteval) // evaluation time interval (at the end)
| ~~~~~~~~~^~~~~~~
| interval
~/mujoco_wasm/include/mujoco/mjmodel.h:364:10: note: 'interval' declared here
364 | mjtNum interval; // evaluation time interval (at the end)
| ^
Finally setting aside some spare time to play around with this, and I really appreciate the polish/effort/examples/etc. you put into this. Thank you!! 🙏
mkdir build
cd build
emcmake cmake ..
make
when I do make , something is error
[ 50%] Building CXX object src/CMakeFiles/mujoco_wasm.dir/main.genned.cc.o
[100%] Linking CXX executable /Downloads/mujoco_wasm-main/dist/mujoco_wasm.js
error: undefined symbol: saveSetjmp (referenced by root reference (e.g. compiled C/C++ code))
warning: To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _saveSetjmp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: testSetjmp (referenced by root reference (e.g. compiled C/C++ code))
warning: _testSetjmp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: '/home/zy/Downloads/emsdk/node/18.20.3_64bit/bin/node /home/zy/Downloads/emsdk/upstream/emscripten/src/compiler.mjs /tmp/tmpfhv1mae3.json' failed (returned 1)
make[2]: *** [src/CMakeFiles/mujoco_wasm.dir/build.make:100:/home/zy/Downloads/mujoco_wasm-main/dist/mujoco_wasm.js] 错误 1
make[1]: *** [CMakeFiles/Makefile2:98:src/CMakeFiles/mujoco_wasm.dir/all] 错误 2
make: *** [Makefile:136:all] 错误 2
cmake version 3.28.3
ubuntu 22.04
Hi,
seems this is far behind than initial demo. I can transfer you rights for npm's mujoco_wasm if you want to publish this
Hi, really cool work!
I played with the online demo https://zalo.github.io/mujoco_wasm/ on safari (16.3) + chrome (112.0.5615.49) and I noticed that the Cassie, Hand and Mug mujoco models are not shown.
Do they work only in specific browsers e.g. firefox?
for example, looking at the live demo (https://zalo.github.io/mujoco_wasm/)
the body names are initialized based on the model.name_bodyadr
array.
However, the names
array has less entries than the largest index in name_bodyadr
also, the 0th body should logically be world, but here the 9th entry in names
is "thigh_left", so it looks like the indexing is not as expected.
My guess is that the name_bodyadr
indexing is a character count, as model.names is a long array of chars, later converted into a string and then split.
If I have time I could look into a PR and fix, if you agree with this assessment.
https://zalo.github.io/mujoco_wasm/
Uncaught SyntaxError: await is a reserved identifiermain.js:10:1
But it works in Edge.
When using the latest emscripten version (3.1.61), the README instructions
mkdir build
cd build
emcmake cmake ..
make
leads to a build that doesn't run the simple example scene, giving the following error instead:
Uncaught 5582208
Fix:
Using emscripten version 3.1.37 solved this issue, installed according to https://emscripten.org/docs/getting_started/downloads.html
Hi very cool libs
just for info
is possible to add or remove object on fly ?
or is only xml init scene .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.