2 from visualization_msgs.msg
import InteractiveMarker
4 from visualization_msgs.msg
import InteractiveMarkerControl
8 'rotate_x': [1, 1, 0, 0, InteractiveMarkerControl.ROTATE_AXIS],
9 'rotate_y': [1, 0, 0, 1, InteractiveMarkerControl.ROTATE_AXIS],
10 'rotate_z': [1, 0, 1, 0, InteractiveMarkerControl.ROTATE_AXIS],
11 'move_x': [1, 1, 0, 0, InteractiveMarkerControl.MOVE_AXIS],
12 'move_y': [1, 0, 0, 1, InteractiveMarkerControl.MOVE_AXIS],
13 'move_z': [1, 0, 1, 0, InteractiveMarkerControl.MOVE_AXIS],
23 def __init__(self, name="interactive_markers"):
27 self.
mg.scale = [.25] * 3
31 def makeMarker(self, callback=None, marker=None, pose=[0, 0, 0], controls=[],
32 fixed=False, name=None, frame="map", description="", imode=0, rot=[0, 0, 0, 1]):
35 marker = self.
mg.marker()
38 callback = default_callback
41 name =
"control%d" % self.
c 44 int_marker = InteractiveMarker()
45 int_marker.header.frame_id = frame
46 int_marker.pose.position.x = pose[0]
47 int_marker.pose.position.y = pose[1]
48 int_marker.pose.position.z = pose[2]
49 int_marker.pose.orientation.x = rot[0]
50 int_marker.pose.orientation.y = rot[1]
51 int_marker.pose.orientation.z = rot[2]
52 int_marker.pose.orientation.w = rot[3]
54 int_marker.name = name
55 int_marker.description = description
57 control = InteractiveMarkerControl()
58 control.always_visible =
True 59 control.interaction_mode = imode
60 control.markers.append(marker)
61 int_marker.controls.append(control)
63 for control_name
in controls:
64 data = TYPEDATA[control_name]
65 control = InteractiveMarkerControl()
66 control.orientation.w = data[0] / SQRT2
67 control.orientation.x = data[1] / SQRT2
68 control.orientation.y = data[2] / SQRT2
69 control.orientation.z = data[3] / SQRT2
70 control.name = control_name
71 control.interaction_mode = data[4]
73 control.orientation_mode = InteractiveMarkerControl.FIXED
74 int_marker.controls.append(control)
76 self.
server.insert(int_marker, callback)
def default_callback(feedback)
def makeMarker(self, callback=None, marker=None, pose=[0, controls=[], fixed=False, name=None, frame="map", description="", imode=0, rot=[0)
def __init__(self, name="interactive_markers")