4 from std_msgs.msg
import ColorRGBA
5 from geometry_msgs.msg
import Point
as PointMessage
6 from visualization_msgs.msg
import Marker
7 from circle
import Point
9 RVIZ_TOPIC =
"/wallfollowing_visualization" 11 RVIZ_NAMESPACE =
"wall_following" 13 marker_publisher = rospy.Publisher(RVIZ_TOPIC, Marker, queue_size=1)
18 message.header.frame_id = RVIZ_FRAME
19 message.header.stamp = rospy.Time.now()
20 message.ns = RVIZ_NAMESPACE
21 message.type = Marker.ADD
22 message.pose.orientation.w = 1
25 message.type = Marker.LINE_STRIP
26 message.scale.x = line_width
28 if isinstance(points, np.ndarray):
29 message.points = [PointMessage(points[i, 1], -points[i, 0], 0)
for i
in range(points.shape[0])]
30 elif isinstance(points, list):
31 message.points = [PointMessage(point.y, -point.x, 0)
for point
in points]
33 raise Exception(
"points should be a numpy array or list of points, but is " + str(type(points)) +
".")
35 marker_publisher.publish(message)
39 start_angle = circle.get_angle(
Point(wall[0, 0], wall[0, 1]))
40 end_angle = circle.get_angle(
Point(wall[-1, 0], wall[-1, 1]))
41 points = circle.create_array(start_angle, end_angle)
def show_line_in_rviz(id, points, color, line_width=0.02)
def show_circle_in_rviz(circle, wall, id)