https://github.com/hesic73/qmujocosim
A simple MuJoCo simulator implemented in Qt
https://github.com/hesic73/qmujocosim
mujoco qt qt6
Last synced: about 1 month ago
JSON representation
A simple MuJoCo simulator implemented in Qt
- Host: GitHub
- URL: https://github.com/hesic73/qmujocosim
- Owner: hesic73
- License: mit
- Created: 2024-03-13T03:31:37.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-13T00:44:15.000Z (about 1 year ago)
- Last Synced: 2025-03-17T20:44:43.841Z (about 2 months ago)
- Topics: mujoco, qt, qt6
- Language: C++
- Homepage:
- Size: 145 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QMuJoCoSim

[](https://raw.githubusercontent.com/hesic73/PictureConverter/master/LICENSE)## Controls Guide
| Function | Key/Action |
| ------------------- | -------------------- |
| Open | Ctrl + O |
| Quit | Ctrl + Q |
| Play / Pause | Space |
| Speed Up / Down | + / - |
| Step Back / Forward | Left / Right Arrow |
| Zoom | Scroll / Middle drag |
| View Orbit | Left drag |
| View Pan | Shift + Right Drag |## Build Specifications
The following are the primary components and specific versions utilized for development (similar versions may also work):
- **CMake**: 3.22.1
- **C++ Compiler**: g++ 11.4.0 (C++20 standard)
- **Qt6**: 6.6.2
- **MuJoCo**: 3.1.2## Compilation
```bash
mkdir -p build && cd build
# e.g. cmake ../ -DCMAKE_PREFIX_PATH:PATH="/opt/mujoco-3.1.2/;/home/admin1/Qt/6.6.2/gcc_64/"
cmake ../ -DCMAKE_PREFIX_PATH:PATH="path/to/mujoco;path/to/qt/library"
cmake --build . --config Release
```## To-Do List
- [x] drag and drop
- [x] screenshot
- [x] print model/data
- [x] toggling OpenGL Effects
- [x] free camera control
- [ ] free camera align
- [x] toggling model elements
- [x] slowdown
- [ ] headlight control
- [x] history buffer
- [x] settings dialog
- [x] profiler## Known Issues
- As we use `QOpenGLWindow` to embed MuJoCo, handling key press events is a bit tricky. Right now, almost all key presses are caught by the simulation window instead of the main window.
- ~~Currently, the rendering operates at a constant FPS, based on the presumption that **simulation speed surpasses real-time**. Should this not be the case, the program could become overloaded.~~ Updated the simulation loop to mirror the approach used in MuJoCo's official simulation example. However, rendering still occurs at a constant FPS.
- When the simulation is paused, the thread halts until resumed, rather than continuously calling `mj_forward`. Consequently, the profiler's CPU time measurement remains static during pauses, unlike in the official simulator.## Reference
- https://gist.github.com/JeanElsner/755d0feb49864ecadab4ef00fd49a22b
- https://github.com/google-deepmind/mujoco/tree/main/simulate
- https://stackoverflow.com/a/37119983/15687189