-
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
Using the built-in python viewer as a non-interactive synchronized viewer? #665
Comments
I believe you are asking for the passive viewer mode described in the 3rd subsection here. |
Thanks for the prompt answer! Actually I tried the 3rd subsection approach, which is |
If I understand the code logic here for |
I see, you want a non-blocking passive viewer, correct? I'm not sure you can do that in a single process in Python, but I might be wrong. @saran-t, is there a recommended MO for this use case? |
Yes exactly. Sorry I did not make it clear enough. |
I have also tried to put
So that |
In m1 mac using jupyter notebook, even the viewer does not start for me inside the thread |
Running the viewer in a thread is problematic, that's why the REPL mode is implemented the way it is. For the use case that you mentioned, the best thing to do would be to run your agent loop in a separate thread, but then you'd need to do the timekeeping yourself (you almost definitely don't want to just let the loop run as fast as possible), or install your controller into |
Here is an example of using the Here is the viewer's physics thread which you could re-implement so that your code controls every aspect of the physics simulation (and thus you can also add a controller and disable perturbations from the viewer). |
Thanks a lot @saran-t and @aftersomemath ! I did not know It is not as simple for me to hand over the main process to the viewer in the current architecture. However, I think I can still try to run viewer in a subprocess and update the The information and suggestions are really helpful. I will close this issue. |
Hi,
I really like the new
viewer
in the python bindings that wrapssimulate.cc
. If my understanding is correct, it is currently serving as an interactive viewer for the users to interact with the models.I am wondering whether I can use it for another use case. I would like to visualize how a neural network plays with the robot model. In this case, the viewer is in a "view only" mode, and it updates the visualization as the
MjModel
andMjData
step forward with the actions produced by the neural network. As a plus, if I can still use the mouse to change the viewpoint in the viewer it would be great.Currently when I call
viewer.launch(model, data)
it will block. If it is started in another process, I am not sure what is the recommended approach to send the update on theMjData
to that process.Thanks!
The text was updated successfully, but these errors were encountered: