19 from simple_script_server
import *
34 param_prefix =
"~control_buttons" 35 if not rospy.has_param(param_prefix):
36 rospy.logerr(
"parameter %s does not exist on ROS Parameter Server, aborting...",param_prefix)
38 group_param = rospy.get_param(param_prefix)
40 group_param = self.
SortDict(group_param)
43 for group
in group_param:
44 group_name = group[1][
"group_name"]
45 component_name = group[1][
"component_name"]
46 button_list = group[1][
"buttons"]
48 for button
in button_list:
50 if button[1] ==
"move":
51 buttons.append(self.
CreateButton(button[0],self.sss.move,component_name,button[2]))
52 elif button[1] ==
"move_base_rel":
53 buttons.append(self.
CreateButton(button[0],self.sss.move_base_rel,component_name,button[2]))
54 elif button[1] ==
"trigger_action":
55 buttons.append(self.
CreateButton(button[0],self.sss.trigger_action,component_name,button[2],
True))
56 elif button[1] ==
"string_action":
57 buttons.append(self.
CreateButton(button[0],self.sss.string_action,component_name,button[2],
True))
58 elif button[1] ==
"trigger":
59 buttons.append(self.
CreateButton(button[0],self.sss.trigger,component_name,button[2]))
60 if button[2] ==
"stop":
61 self.stop_buttons.append(component_name)
62 if button[2] ==
"init":
63 self.init_buttons.append(component_name)
64 if button[2] ==
"recover":
65 self.recover_buttons.append(component_name)
66 if button[2] ==
"halt":
67 self.halt_buttons.append(component_name)
68 elif button[1] ==
"stop":
69 buttons.append(self.
CreateButton(button[0],self.sss.stop,component_name))
70 self.stop_buttons.append(component_name)
71 elif button[1] ==
"init":
72 buttons.append(self.
CreateButton(button[0],self.sss.init,component_name))
73 self.init_buttons.append(component_name)
74 elif button[1] ==
"recover":
75 buttons.append(self.
CreateButton(button[0],self.sss.recover,component_name))
76 self.recover_buttons.append(component_name)
77 elif button[1] ==
"halt":
78 buttons.append(self.
CreateButton(button[0],self.sss.halt,component_name))
79 self.halt_buttons.append(component_name)
81 rospy.logerr(
"Function <<%s>> not known to command gui",button[1])
83 group = (group_name,buttons)
86 if component_name ==
"base":
87 param_prefix =
"~nav_buttons" 88 if rospy.has_param(param_prefix):
89 nav_buttons_param = rospy.get_param(param_prefix)
90 nav_button_list = nav_buttons_param[
"buttons"]
92 for button
in nav_button_list:
94 buttons.append(self.
CreateButton(button[0],self.sss.move,component_name,button[2]))
96 rospy.logwarn(
"parameter %s does not exist on ROS Parameter Server, no nav buttons will be available.",param_prefix)
97 self.panels.append(group)
107 def CreateButton(self,button_name,function,component_name,parameter_name=None,blocking=False):
108 if parameter_name ==
None:
109 button = (button_name,function,(component_name,blocking))
111 button = (button_name,function,(component_name,parameter_name,blocking))
116 keys = sorted(dictionary.keys())
121 return [[key,dictionary[key]]
for key
in keys]
138 if marker
in seen:
continue