Commit Graph

19 Commits

Author SHA1 Message Date
Saran Tunyasuvunakool e40775fab3 Abstract out GLFW calls from Simulate.
PiperOrigin-RevId: 500129478
Change-Id: I7ba998e20439575ad9a3fe1a866c3db4c36b9328
2023-01-06 02:45:56 -08:00
Gianfranco Costamagna 0b33fd9eaa sed s/atomic_bool/atomic_int/g -i simulate/simulate.h
Change atomic_bool to atomic_int to make sure that the compiler will try the best to
generate machine code, instead of relying on an external atomic library
2022-12-08 21:24:00 +01:00
Copybara-Service f7b256de91 Merge pull request #419 from aftersomemath:simulate-python
PiperOrigin-RevId: 487496285
Change-Id: I17d15bd2a3886e5ce1631f4eb78afa94830d08cc
2022-11-10 04:12:34 -08:00
Levi Burner e12343ae51 remove stray #include 2022-10-04 14:55:26 -04:00
Levi Burner 95a4b1c551 simulate python: fix cmake, glfw usage, update Python version of physics loop 2022-10-04 14:37:06 -04:00
Alessio Quaglino bc1490b7a8 Add realtime parameter to visual global.
PiperOrigin-RevId: 478775714
Change-Id: Ic2d178a5c57d298d005215219ce8470392c4651b
2022-10-04 07:09:15 -07:00
Yuval Tassa 834e8dd506 Improvements to time synchronisation in simulate.
- Improved time-sync logic readability in `PhysicsLoop`.
- Fixed unattainable condition for breaking from stepping loop if data was reset.
- Added measurement of actual real-time tracking.
- Moved slowdown overlay to top left.
- Report slowdown as % of real-time, rather than fraction.
- Report actual slowdown if different than requested (very small timestep, PhysicsLoop cannot keep up) by more than 10%.
- Replaced slowdown increments of 2 with decimal-rounded increments of 10^(1/10). This is a finer-grained scale (approximately 3x as fine) and well suited for decimal percentage representation.
- Maximum slowdown increased to 1000.
- Added `Simulate.refreshrate` with a default of 60Hz, in case videomode refreshrate is 0 (can occur e.g. when forwarding over X11).
- Remove realtime reporting from regular info overlay.
- Various cleanups.

PiperOrigin-RevId: 471547481
Change-Id: Idd2514a4defb1dc431617f3a515cc747c4fd8971
2022-09-01 09:09:48 -07:00
Saran Tunyasuvunakool 3240596c3a Call GLFW functions via a dynamic dispatch table.
This allows us to use GLFW without needing to introduce a link-time dependency on the library, which in turn enables us to get GLFW through Python.

PiperOrigin-RevId: 470100999
Change-Id: I27c84ad3310afdbebd582ab0033b6a963ba6307e
2022-08-25 15:41:53 -07:00
Kevin Zakka 80b4ffdd6a Add screenshot button to simulate.
PiperOrigin-RevId: 465628684
Change-Id: I0eb86d6b18c25bb437f197229be6d1c57ccbc50a
2022-08-05 12:56:32 -07:00
Saran Tunyasuvunakool e40b9da181 Merge pull request #201 from aftersomemath:refactor-simulate
PiperOrigin-RevId: 465044152
Change-Id: I54e65a30764a444dbd175260314d685fd7ffa6a1
2022-08-03 15:32:15 +01:00
Levi Burner e036e9a229 Simulate: Make sure all class members are initialized 2022-07-08 16:04:12 -04:00
Levi Burner 655eec1d63 Link GLFW as a shared library by default
Use one option name to control building GLFW as static/shared since it
is not straightforward to set it seperately for the samples and simulate
2022-07-08 16:04:12 -04:00
Levi Burner 1788d23da6 Simulate: disable mjsimulate shared library, multiple linkages of glfw cause crash on MacOS 2022-07-08 16:04:12 -04:00
Levi Burner 70ec29a722 Simulate: fix header includes 2022-07-08 16:04:12 -04:00
Levi Burner a526a6bd78 Simulate: move all glfw calls to main thread to fix MacOS 2022-07-08 16:04:12 -04:00
Levi Burner ed82f055e8 Simulate: fixes for windows version 2022-07-08 16:04:12 -04:00
Levi Burner 033ca81db6 Simulate: fix reload button causing segfault, make interface changes needed for Python bindings 2022-07-08 16:04:12 -04:00
Levi Burner 447877abef Simulate creates and maintains its own thread 2022-07-08 16:04:12 -04:00
Levi Burner 65d5ade426 Refactor simulate to split UI from application
Fix name of glew library

Move simulate to new directory and refactor to use C++ conventions

Wrap simulate in mujoco namespace

fix namespaces, convert struct to class, use std::lock_guard

use GetMutex to better handle destruction ordering

rename mjSimulate to Simulate

nit: space before public and typo

move startup print

use nullptr instead of NULL

use GetInstance() to get simulate object

convert init to default constructor
2022-07-08 16:04:07 -04:00