RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.35k stars 1.27k forks source link

MeshcatVisualizer doesn't handle mesh scale #10777

Closed RussTedrake closed 4 years ago

RussTedrake commented 5 years ago

leading to a comically large quadrotor in meshcat: https://github.com/RussTedrake/underactuated/blob/master/src/quadrotor/lqr.py https://github.com/RobotLocomotion/drake/blob/master/examples/quadrotor/quadrotor.urdf#L17

the information is available to the MeshcatVisualizer class in the lcm message https://github.com/RobotLocomotion/drake/blob/master/geometry/geometry_visualization.cc#L106

but I don't think meshcat-python lets me send it through, yet: https://github.com/rdeits/meshcat-python/blob/master/src/meshcat/geometry.py#L314

my simple attempt (adding to meshcat_visualizer.py line 211):

                    element_local_tf[3,:3] = geom.float_data[:3]

didn't seem to work.

@gizatt -- might you take a quick look to see if it's an easy fix?

gizatt commented 5 years ago

What you tried was really close to a solution -- didn't work for me either. element_local_tf[:3, :3] = element_local_tf[:3, :3].dot(np.diag(geom.float_data[:3])) did, though.

It doesn't look like meshcat-python supports the real three.js scale interface yet (mentioned here), though I think it'd be a trivial addition. I can open a PR with this slightly hacky fix to fix this the fastest, and I'll leave a TODO to look out for improved support on the meshcat-python side?

RussTedrake commented 5 years ago

sounds perfect. thanks Greg.

RussTedrake commented 4 years ago

This was resolved by @gizatt long ago.