def draw_arrow(self, namespace, start, end, r=1, g=1, b=1, a=1, width=0.01, frame=None): marker = blank_marker(self.consume_id(namespace), namespace, r, g, b, a, self.__resframe(frame)) marker.type = Marker.ARROW marker.scale.x = width marker.scale.y = 2 * width marker.points.extend([auto_encode(start), auto_encode(end)]) self.current_msg[namespace].markers.append(marker)
def draw_points(self, namespace, pose, size, points, r=1, g=0, b=0, a=1, frame=None, colors=None): marker = blank_marker(self.consume_id(namespace), namespace, r, g, b, a, self.__resframe(frame)) marker.type = Marker.POINTS marker.pose = auto_encode(pose) marker.points = [auto_encode(p) for p in points] marker.colors = [] if colors is None else [color(*c) for c in colors] marker.scale.x = size marker.scale.y = size marker.scale.z = size self.current_msg[namespace].markers.append(marker)
def draw_text(self, namespace, position, text, r=1, g=1, b=1, a=1, height=0.08, frame=None): marker = blank_marker(self.consume_id(namespace), namespace, r, g, b, a, self.__resframe(frame)) marker.type = Marker.TEXT_VIEW_FACING marker.pose.position = auto_encode(position) marker.scale.z = height marker.text = text self.current_msg[namespace].markers.append(marker)
def draw_mesh(self, namespace, pose, scale, resource, frame=None, r=0, g=0, b=0, a=0, use_mat=True): marker = blank_marker(self.consume_id(namespace), namespace, r, g, b, a, self.__resframe(frame)) marker.type = Marker.MESH_RESOURCE marker.pose = auto_encode(pose) marker.scale = encode_vector(scale) marker.mesh_resource = resource marker.mesh_use_embedded_materials = use_mat self.current_msg[namespace].markers.append(marker)
def draw_sphere(self, namespace, position, radius, r=1, g=0, b=0, a=1, frame=None): marker = blank_marker(self.consume_id(namespace), namespace, r, g, b, a, self.__resframe(frame)) marker.type = Marker.SPHERE marker.pose.position = auto_encode(position) marker.scale = encode_vector([radius * 2] * 3) self.current_msg[namespace].markers.append(marker)
def draw_shape(self, namespace, pose, scale, shape, r=1, g=1, b=1, a=1, frame=None): marker = blank_marker(self.consume_id(namespace), namespace, r, g, b, a, self.__resframe(frame)) marker.type = shape marker.pose = auto_encode(pose) marker.scale = encode_vector(scale) self.current_msg[namespace].markers.append(marker)