34 from visualization_msgs.msg
import InteractiveMarkerFeedback
35 from visualization_msgs.msg
import MenuEntry
63 def insert(self, title, parent=None, command_type=MenuEntry.FEEDBACK, command="", callback=None):
64 handle = self.
doInsert(title, command_type, command, callback)
65 if parent
is not None:
68 parent_context.sub_entries.append(handle)
70 rospy.logerr(
"Parent menu entry " + str(parent) +
" not found.")
80 context.visible = visible
89 context.check_state = check_state
99 return context.check_state
105 def apply(self, server, marker_name):
106 marker = server.get(marker_name)
111 marker.menu_entries = list()
114 server.insert(marker, self.
processFeedback, InteractiveMarkerFeedback.MENU_SELECT)
125 for marker
in managed_markers:
126 success = self.
apply(server, marker)
and success
143 context.feedback_cb(feedback)
148 for handle
in handles_in:
151 if not context.visible:
153 entries_out.append(self.
makeEntry(context, handle, parent_handle))
157 rospy.logerr(
"Internal error: context handle not found! This is a bug in MenuHandler.")
162 menu_entry = MenuEntry()
164 menu_entry.title = context.title
165 elif context.check_state == self.
CHECKED:
166 menu_entry.title =
"[x] "+context.title
167 elif context.check_state == self.
UNCHECKED:
168 menu_entry.title =
"[ ] "+context.title
170 menu_entry.command = context.command
171 menu_entry.command_type = context.command_type
172 menu_entry.id = handle
173 menu_entry.parent_id = parent_handle
178 def doInsert(self, title, command_type, command, feedback_cb):
183 context.title = title
184 context.command = command
185 context.command_type = command_type
186 context.visible =
True
188 context.feedback_cb = feedback_cb