5 from interactive_markers.interactive_marker_server
import InteractiveMarkerServer
7 from visualization_msgs.msg
import (InteractiveMarkerControl, Marker, InteractiveMarker )
8 from geometry_msgs.msg
import Point
9 from localizer_dwm1001.msg
import Anchor
10 from localizer_dwm1001.msg
import Tag
14 rospy.init_node(
"display_map")
15 server = InteractiveMarkerServer(
"DWM1001_Anchors_And_Tag_Server")
23 Process feedback of markers 25 :param: feedback of markers 30 p = feedback.pose.position
31 rospy.loginfo(feedback.marker_name +
" is pluginsnow at " + str(p.x) +
", " + str(p.y) +
", " + str(p.z))
36 Create a box controll for tag 38 :param: msg from marker 44 control = InteractiveMarkerControl()
45 control.always_visible =
True 47 msg.controls.append( control )
52 Create a box control for anchor 54 :param: msg from marker 59 control = InteractiveMarkerControl()
60 control.always_visible =
True 62 msg.controls.append( control )
67 Create a white sphere for tag 69 :param: msg from marker 76 marker.type = Marker.SPHERE
77 marker.scale.x = msg.scale * 0.45
78 marker.scale.y = msg.scale * 0.45
79 marker.scale.z = msg.scale * 0.45
89 Create a grey cube for anchor 91 :param: msg from marker 99 marker.type = Marker.CUBE
100 marker.scale.x = msg.scale * 0.45
101 marker.scale.y = msg.scale * 0.45
102 marker.scale.z = msg.scale * 0.45
113 Make coordinates and control for tag 115 :param: position of tag 122 int_marker = InteractiveMarker()
123 int_marker.header.frame_id =
"map" 124 int_marker.pose.position = position
127 int_marker.name = name
128 int_marker.description = name
132 control = InteractiveMarkerControl()
133 control.orientation.w = 1
134 control.orientation.x = 0
135 control.orientation.y = 1
136 control.orientation.z = 0
137 control.interaction_mode = InteractiveMarkerControl.MOVE_ROTATE
138 int_marker.controls.append(copy.deepcopy(control))
139 control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
140 int_marker.controls.append(control)
148 Make coordinates and control for anchor 150 :param: position of anchor 151 :param: name for anchor 157 int_marker = InteractiveMarker()
158 int_marker.header.frame_id =
"map" 159 int_marker.pose.position = position
161 int_marker.description = name
162 int_marker.name = name
166 control = InteractiveMarkerControl()
167 control.orientation.w = 1
168 control.orientation.x = 0
169 control.orientation.y = 1
170 control.orientation.z = 0
171 control.interaction_mode = InteractiveMarkerControl.MOVE_ROTATE
172 int_marker.controls.append(copy.deepcopy(control))
173 control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS
174 int_marker.controls.append(control)
182 Callback from topic /dwm1001/anchor0 184 :param: data of anchor 0 194 position = Point(data.x, data.y, data.z)
198 rospy.loginfo(
"Anchor0 x: " + str(data.x) +
" y: " + str(data.y) +
" z: " + str(data.z))
200 rospy.loginfo(
"Value error")
206 Callback from topic /dwm1001/anchor1 208 :param: data of anchor 1 219 position = Point(data.x, data.y, data.z)
224 rospy.loginfo(
"Anchor1 x: "+ str(data.x) +
" y: " + str(data.y) +
" z: " + str(data.z))
227 rospy.loginfo(
"Value error")
233 Callback from topic /dwm1001/anchor2 235 :param: data of anchor 2 246 position = Point(data.x, data.y, data.z)
250 rospy.loginfo(
"Anchor2 x: " + str(data.x) +
" y: " + str(data.y) +
" z: " + str(data.z))
253 rospy.loginfo(
"Value error")
257 Callback from topic /dwm1001/anchor3 259 :param: data of anchor 3 270 position = Point(data.x, data.y, data.z)
274 rospy.loginfo(
"Anchor3 x: " + str(data.x) +
" y: " + str(data.y) +
" z: " + str(data.z))
277 rospy.loginfo(
"Value error")
281 Callback from topic /dwm1001/tag 293 position = Point(data.x, data.y, data.z)
297 server.applyChanges()
300 rospy.loginfo(
"Tag x: " + str(data.x) +
" y: " + str(data.y) +
" z: " + str(data.z))
303 rospy.loginfo(
"Value error")
312 rospy.Subscriber(
"/dwm1001/tag" , Tag , self.
TagCallback)
319 displayInRviz.start()
321 if __name__==
"__main__":
def Anchor2callback(self, data)
def Anchor3callback(self, data)
def makeBoxControlTag(self, msg)
def makeGreyCubeAnchor(self, msg)
def makeBoxControlAnchor(self, msg)
def Anchor0callback(self, data)
def makeTagMarker(self, position, name)
def makeWhiteSphereTag(self, msg)
def processFeedback(self, feedback)
def Anchor1callback(self, data)
def makeAnchorMarker(self, position, name)
def TagCallback(self, data)