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

Function register_arrowed_line

sandbox/viz_utils.py:92–108  ·  view source on GitHub ↗
(
    viz: MeshcatVisualizer,
    pt1: np.ndarray,
    pt2: np.ndarray,
    line_name: str,
    linewidth: float = 0.01,
    color: np.ndarray = BLACK,
)

Source from the content-addressed store, hash-verified

90
91
92def register_arrowed_line(
93 viz: MeshcatVisualizer,
94 pt1: np.ndarray,
95 pt2: np.ndarray,
96 line_name: str,
97 linewidth: float = 0.01,
98 color: np.ndarray = BLACK,
99) -> int:
100 height = np.linalg.norm(pt2 - pt1)
101 if height > 1e-6:
102 register_line(viz, pt1, pt2, line_name, linewidth, color)
103 arrow: hppfcl.Convex = create_arrow_head(4 * linewidth)
104 M = pin.SE3(np.eye(3), np.array([0.0, 0.0, height / 2]))
105 arrow_shape = load_primitive(arrow)
106 arrow_name = line_name + "/arrow"
107 viz.viewer[arrow_name].set_object(arrow_shape, meshcat_material(*color))
108 viz.viewer[arrow_name].set_transform(M.homogeneous)
109
110
111def transform_object(

Callers 1

simulateSytemFunction · 0.90

Calls 4

register_lineFunction · 0.85
create_arrow_headFunction · 0.85
load_primitiveFunction · 0.85
meshcat_materialFunction · 0.85

Tested by

no test coverage detected