-
Notifications
You must be signed in to change notification settings - Fork 35
[Won't Merge] Refactoring #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
+ mujoco_viewer thread safe and refactored entirely from mujoco_viewer v0.1.0 + efficient and responsive key callback + resize callback + co-develop along with mujoco-python-engine https://github.com/jaku-jaku/jx-mujoco-python-engine + [wip] mujoco camera buffer backend
+ modified examples to fit our lib
+ viewer minor fixes on mouse interactions
+ camera acquisition works
Hi @jaku-jaku Nevertheless, since you opened issue #16 I've been working on rendering multiple cameras on the side, besides some other cool features. Hope I can spend more time on this soon.
Did this give you noticeably better performance? Thanks. |
Yeah, but I kinda refactored almost everything into my personal style I preferred, that's why it might be hard to merge in. I personally feel the refactored version will be easier to collaborate on. The main intention was to make the code architecture clean and easy to scale with more key registrations in the future, and serve as GUI interface in joint with main engine code. The rendering will be invoked by the engine thread, so separating the GUI callbacks and Rendering pipeline will be a good measure to void any potential bugs. Lemme know your thoughts.
Nice, many thanks!
It's not much noticeable, but I just feel the If-else statement (used in mujoco-py) is quite itchy (from C/C++ POV), and can be buggy. So, in the engine code, I can run in the update functions (or maybe separate thread in the future): # - render current view:
for i in range(10):
mujoco.mj_step(self.mj_model._model, self.mj_data._data) # stepping couple times
self.mj_viewer.process_safe() # process GUI interfaces (keys registered till this update and mouse interactions) that was registered in callbacks
self.mj_viewer.update_safe() # update the scene via mujoco2.2.x
self.mj_viewer.render_safe() # render the raw main viewer off screen, and display on_screen with overlays
self.mj_viewer.render_sensor_cameras_safe() # iterate through camera configurations, update the scene and render cameras off-screen
|
Hi Rohan,
Here is my revision of the viewer:
Major refactoring:
Let me know if you have any comments.
Thank you for your initial works.
Best
Jack