Reputation: 91
What is the standard way of saving videos using MeshcatVisualizer? I know the following works for wrappers of PyPlotVisualizer:
visualizer.start_recording()
simulator.AdvanceTo(T)
ani = visualizer.get_recording_as_animation()
But the two relevant methods are not available for MeshcatVisualizer, and there don't seem to be any examples in the repo that create videos using it, and none of the methods that the class does have seemed like promising candidates. Failing that, is there another way of saving videos for 3D visualizations?
Upvotes: 3
Views: 1023
Reputation: 5533
I don't believe that meshcat offers it's own recording functionality, which means the recommended workflow would be to just use your favorite screen recorder software. I've forwarded this to a few meshcat experts in case they have something better to recommend.
Update: In addition to rdeits answer above, he had a few more details in email:
there's a built in animation API with recording support in
meshcat-python
(see "Recording an Animation" in https://github.com/rdeits/meshcat-python/blob/master/animation_demo.ipynb ), but AFAICT Drake's MeshcatVisualizer isn't hooked up to it. It might not be that hard to do so--the basic idea is that you can useat_frame
to get a representation of a single frame of an animation that behaves like ameshcat.Visualizer
. You can callset_transform
on that frame, and rather than moving anything in the viewer it will instead record that action into an animation track. Then you can send the whole animation at once to the visualizer and let the browser side handle replaying and recording it.
Upvotes: 1
Reputation: 122
Meshcat has an animation tool: https://github.com/rdeits/meshcat-python/blob/master/animation_demo.ipynb , you can access MeshcatVisualizer
's meshcat.Visualizer
instance via MeshcatVisualizer.vis
. However, MeshcatVisualizer
doesn't have a function like MeshcatVisualizer.convert_to_video
that supports this animation tool at the moment. Perhaps the easier route for now is screen recording.
Upvotes: 5