21 from visualization_msgs.msg
import Marker
22 from visualization_msgs.msg
import MarkerArray
23 from dynamic_reconfigure.server
import Server
24 from cob_helper_tools.cfg
import HelperToolsConfig
30 self.
pubGoals = rospy.Publisher(
'visualize_navigation_goals', MarkerArray, queue_size=1, latch=
True)
37 navigation_goals = rospy.get_param(
"/script_server/base", {})
39 markerarray = MarkerArray()
41 for name, pose
in list(navigation_goals.items()):
48 marker_arrow = Marker()
49 marker_arrow.header.stamp = rospy.Time.now()
50 marker_arrow.header.frame_id =
"map" 51 marker_arrow.ns =
"/"+name
53 marker_arrow.type = Marker.ARROW
54 marker_arrow.action = Marker.ADD
55 marker_arrow.scale.x = 1.0
56 marker_arrow.scale.y = 0.1
57 marker_arrow.scale.z = 0.1
58 marker_arrow.color.r = 0.0
59 marker_arrow.color.g = 0.0
60 marker_arrow.color.b = 1.0
61 marker_arrow.color.a = 1.0
62 marker_arrow.pose.position.x = pose[0]
63 marker_arrow.pose.position.y = pose[1]
64 marker_arrow.pose.position.z = 0.2
65 quaternion = tf.transformations.quaternion_from_euler(0, 0, pose[2])
66 marker_arrow.pose.orientation.x = quaternion[0]
67 marker_arrow.pose.orientation.y = quaternion[1]
68 marker_arrow.pose.orientation.z = quaternion[2]
69 marker_arrow.pose.orientation.w = quaternion[3]
70 markerarray.markers.append(marker_arrow)
73 marker_text = Marker()
74 marker_text.header.stamp = rospy.Time.now()
75 marker_text.header.frame_id =
"map" 76 marker_text.ns =
"/"+name
77 marker_text.id = i + 1000000
78 marker_text.type = Marker.TEXT_VIEW_FACING
79 marker_text.action = Marker.ADD
81 marker_text.color.r = 0.0
82 marker_text.color.g = 0.0
83 marker_text.color.b = 1.0
84 marker_text.color.a = 1.0
85 marker_text.pose.position.x = pose[0]
86 marker_text.pose.position.y = pose[1] + 0.2
87 marker_text.pose.position.z = 0.2
88 quaternion = tf.transformations.quaternion_from_euler(0, 0, pose[2])
89 marker_text.pose.orientation.x = quaternion[0]
90 marker_text.pose.orientation.y = quaternion[1]
91 marker_text.pose.orientation.z = quaternion[2]
92 marker_text.pose.orientation.w = quaternion[3]
93 marker_text.text = name
94 markerarray.markers.append(marker_text)
98 self.pubGoals.publish(markerarray)
100 if __name__ ==
"__main__":
101 rospy.init_node(
'navigation_goal_visualizer')
104 while not rospy.is_shutdown():
108 except rospy.exceptions.ROSInterruptException
as e:
def reconfigure_callback(self, config, level)