21 from interactive_markers.interactive_marker_server
import InteractiveMarker, InteractiveMarkerFeedback
22 from visualization_msgs.msg
import Marker, InteractiveMarkerControl
26 def __init__(self, object_names, callback_fct, interactive_server):
43 int_marker = InteractiveMarker()
44 int_marker.header.frame_id =
"/"+object_name
45 int_marker.name = object_name
46 int_marker.description =
"Select this object" 47 int_marker.pose.position.z = -0.3
52 object_marker = Marker()
53 object_marker.type = Marker.SPHERE
54 object_marker.pose.position.z = 0.6
56 object_marker.scale.x = 0.1
57 object_marker.scale.y = 0.1
58 object_marker.scale.z = 0.1
59 object_marker.color.r = 0.6
60 object_marker.color.g = 0.02
61 object_marker.color.b = 1.0
62 object_marker.color.a = 1.0
66 object_control = InteractiveMarkerControl()
67 object_control.interaction_mode = InteractiveMarkerControl.BUTTON
68 object_control.always_visible =
True 69 object_control.markers.append(object_marker)
74 self.
int_markers[object_name].controls.append(object_control)
81 self.server.applyChanges()
85 if feedback.event_type != InteractiveMarkerFeedback.BUTTON_CLICK:
92 selected_name = feedback.marker_name
98 if name == selected_name:
126 self.server.applyChanges()
131 if __name__ ==
"__main__":
132 rospy.init_node(
"simple_marker")
def create_marker(self, object_name)
def processFeedback(self, feedback)
def __init__(self, object_names, callback_fct, interactive_server)