gizatt / pydrake_kuka

MIT License
5 stars 5 forks source link

Visualizing the kuka_iiwa #6

Closed rickyduh closed 5 years ago

rickyduh commented 5 years ago

Once you have the q_traj vector from computing the IK, is there a straightforward way to pass that into the meshcat visualizer to visualize the trajectory? I am trying to understand what aspects of the kuka_sim file are needed for visualizing the trajectory.

gizatt commented 5 years ago

Sorry for the delay! The MeshcatRigidBodyVisualizer object (the version defined in this repo is a little complicated, as it has some customizations to support the cutting behavior I'm simulating here -- the original / base class lives here and is gradually making its way upstream to Drake) can visualize individual joint configurations with meshcat if you invoke the draw method with a joint position vector. I've visualized plans with that before by iterating over the plan (with some time.sleep() calls to slow down the visualization) and calling draw on each joint configuration in sequence.

rickyduh commented 5 years ago

No worries, I was able to figure it out before seeing this but thanks for getting back to me either way. For anyone that's interested, this snippet that I got from the kuka sim file in this repo: pbrv = MeshcatRigidBodyVisualizer(tree, draw_timestep) for t in np.arange(qtraj.start_time(), qtraj.end_time(), sample_time): q = qtraj.value(t)[:] pbrv.draw(q) was all I needed to visualize the kuka iiwa. Thanks for suggesting using time.sleep(). I will play around with that to slow down the visualization