-
Notifications
You must be signed in to change notification settings - Fork 791
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
Mujoco interactive viewer #649
Comments
Did you upgrade to the latest version, i.e. v2.3.1.post1? |
Yes I did. And the import error is gone. |
Regarding the changing of parameters, yes you should be able to do that. In this example the |
I made up my own viewer via pygame lol. https://github.com/umeiko/Mujoco_Pygame_Interface |
I've just finished implementing a non-blocking passive viewer (similar to mujoco_py's viewer) in 230e278 which should sidestep any need for callbacks. This should be shipped as part of the next release in the next few days. We'll post a discussion explaining how to beta test this thing. |
Looking forward to trying it! |
@aftersomemath IIRC you're not a macOS user, so you can try this out right now :) On Windows and Linux, the new |
Great! Does the passive viewer handle locking the mjModel and mjData structures? Or is locking disregarded since in theory the passive viewer doesn't modify the mjModel and mjData, so hopefully worse case scenario is some visual glitches in the viewer? |
It's technically racy, so you're right in that we are relying on the fact that the render thread only reads. In theory you may get some inconsistent rendering if the render is triggered in the middle of a step. Locking isn't something that can be done transparently since only the user's script knows when it's modifying the physics. However, if races do become a problem it'll be relatively straightforward to expose an API for explicit locking. In fact I plan to introduce that in the next-next release anyway when we get around to documenting the passive mode as an officially supported thing. |
I can't imagine races being an issue. What, the renderer tries to draw contact frames in the same instant as the contacts change? The user changes the timestep from the GUI in the middle of an RK4 step? Hard to imagine fatal stuff. I would wait until there is evidence of this really being a problem before giving people APIs that seem to imply that it is one 🙂 |
I mean, if I think what we have now will look plausibly correct but can never be trusted to show the exact correct state unless the user script is not updating the scene. If you're trying to e.g. eyeball contacts in live, running simulation, then I'd say you're almost guaranteed to see the wrong thing. |
At least for me, An alternative lock-free approach is "double buffering". By reading from the visualized data mjData and putting the results in another mjData that is not being visualized. When Many libraries and tools have "unsafe but fast" options that can be turned on, but usually they are not on by default (or at least can be turned off). |
If anyone has comments or feedback relating to |
Hi,
I'm a beginner in MUjoco, and i am trying to use the python-binding to run some model in real-time while changing some motion parameteres. I went through the tutorial . however, they used a mediapy package to replay the scene after the simulation is completed. Then I recently went to the interactive viewer but I got an import error even though Mujoco is installed.
I am using Windows 11, PyCharm Professional IDE and Python 3.7.
So my question is:
1, will the interactive viewer enable me to change some parameters in real-time while their effect is reflected in the viewer instantly. for example, I want to input the rotational velocity of a hinged link in real-time and see the model change its rotation speed in real-time. Is this possible? I am not using physics systems such as gravity, dynamics. But only kinematics to animate my robot.
Thank you.
The text was updated successfully, but these errors were encountered: