1 import roslib; roslib.load_manifest(
'easy_markers')
6 from visualization_msgs.msg
import InteractiveMarkerControl
9 'rotate_x': [1,1,0,0, InteractiveMarkerControl.ROTATE_AXIS],
10 'move_x' : [1,1,0,0, InteractiveMarkerControl.MOVE_AXIS],
11 'rotate_z': [1,0,1,0, InteractiveMarkerControl.ROTATE_AXIS],
12 'move_z' : [1,0,1,0, InteractiveMarkerControl.MOVE_AXIS],
13 'rotate_y': [1,0,0,1, InteractiveMarkerControl.ROTATE_AXIS],
14 'move_y' : [1,0,0,1, InteractiveMarkerControl.MOVE_AXIS]
21 def __init__(self, name="interactive_markers"):
25 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]
67 control.orientation.x = data[1]
68 control.orientation.y = data[2]
69 control.orientation.z = data[3]
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)
78 self.server.applyChanges()
def makeMarker(self, callback=None, marker=None, pose=[0, controls=[], fixed=False, name=None, frame="/map", description="", imode=0, rot=[0)
def default_callback(feedback)
def __init__(self, name="interactive_markers")