(
viz: MeshcatVisualizer,
shape: hppfcl.ShapeBase,
shape_name: str,
M: pin.SE3,
shape_color=np.ones(4),
)
| 42 | |
| 43 | |
| 44 | def register_object( |
| 45 | viz: MeshcatVisualizer, |
| 46 | shape: hppfcl.ShapeBase, |
| 47 | shape_name: str, |
| 48 | M: pin.SE3, |
| 49 | shape_color=np.ones(4), |
| 50 | ) -> int: |
| 51 | meshcat_shape = load_primitive(shape) |
| 52 | if isinstance(shape, (hppfcl.Plane, hppfcl.Halfspace)): |
| 53 | T = M.copy() |
| 54 | T.translation += M.rotation @ (shape.d * shape.n) |
| 55 | T = T.homogeneous |
| 56 | else: |
| 57 | T = M.homogeneous |
| 58 | |
| 59 | # Update viewer configuration. |
| 60 | viz.viewer[shape_name].set_object(meshcat_shape, meshcat_material(*shape_color)) |
| 61 | viz.viewer[shape_name].set_transform(T) |
| 62 | |
| 63 | |
| 64 | def register_line( |
no test coverage detected