35 usage: %prog /action_name action_type 40 from optparse
import OptionParser
46 from cStringIO
import StringIO
47 from library
import to_yaml, yaml_msg_str
48 from dynamic_action
import DynamicAction
74 self.
status_bg.SetBackgroundColour(wx.Colour(200, 0, 0))
75 self.
status.SetLabel(
"Waiting For Goal...")
81 self.
goal.SetValue(
"")
84 self.
status_bg.SetBackgroundColour(wx.Colour(0, 200, 0))
85 self.
status.SetLabel(
"Received Goal. Send feedback, succeed, or abort.")
93 except UnicodeDecodeError:
94 self.
goal.SetValue(
"Cannot display goal due to unprintable characters")
97 self.
status_bg.SetBackgroundColour(wx.Colour(0, 200, 200))
98 self.
status.SetLabel(
"Preempt requested...")
115 if self.
server.is_preempt_requested():
130 self.
server.set_preempted()
147 except roslib.message.SerializationError
as e:
149 wx.MessageBox(str(e),
"Error serializing feedback", wx.OK)
163 except roslib.message.SerializationError
as e:
165 wx.MessageBox(str(e),
"Error serializing result", wx.OK)
192 self.
sz = wx.BoxSizer(wx.VERTICAL)
197 self.
goal = wx.TextCtrl(self.
frame, -1, style=(wx.TE_MULTILINE | wx.TE_READONLY))
227 self.
status_bg.SetBackgroundColour(wx.Colour(200, 0, 0))
235 self.
sz.Add(self.
abort, 0, wx.EXPAND)
249 if __name__ ==
'__main__':
250 rospy.init_node(
'axserver', anonymous=
True)
252 parser = OptionParser(__doc__.strip())
257 (options, args) = parser.parse_args(rospy.myargv())
260 parser.error(
"You must specify the action name and type. Eg: ./axserver.py my_action actionlib/Test")
266 rospy.signal_shutdown(
'GUI shutdown')
def on_preempt(self, event)
def __init__(self, action_type, action_name)
def on_succeed(self, event)
def on_feedback(self, event)
def on_abort(self, event)
def set_preempt_requested(self)
def yaml_msg_str(type_, yaml_str, filename=None)