MCPcopy Create free account
hub / github.com/Simple-Robotics/Simple / register_object

Function register_object

sandbox/viz_utils.py:44–61  ·  view source on GitHub ↗
(
    viz: MeshcatVisualizer,
    shape: hppfcl.ShapeBase,
    shape_name: str,
    M: pin.SE3,
    shape_color=np.ones(4),
)

Source from the content-addressed store, hash-verified

42
43
44def 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
64def register_line(

Callers 1

simulateSytemFunction · 0.90

Calls 2

load_primitiveFunction · 0.85
meshcat_materialFunction · 0.85

Tested by

no test coverage detected