36 PKG =
'pr2_power_board' 39 roslib.load_manifest(PKG)
49 if wxversion.checkInstalled(WXVER):
50 wxversion.select(WXVER)
52 print(
'This application requires wxPython version %s' % (WXVER), file=sys.stderr)
58 import threading, time
62 wx.Panel.__init__(self, parent, wx.ID_ANY)
66 xrc_path = roslib.packages.get_pkg_dir(PKG) +
'/ui/pr2_power_board_panel.xrc' 68 self.
_xrc = xrc.XmlResource(xrc_path)
71 serialBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
72 self.
myList = wx.ComboBox(self, -1, size=(150,30), style=wx.CB_READONLY)
74 serialBoxSizer.Add( wx.StaticText( self, -1,
"Board ") )
75 serialBoxSizer.Add( self.
myList )
76 serialBoxSizer.Add( wx.StaticText( self, -1,
"Serial ") )
82 sizer = wx.BoxSizer(wx.VERTICAL)
83 sizer.Add( serialBoxSizer, 0, wx.TOP)
107 self.
power_control = rospy.ServiceProxy(
'power_board/control', PowerBoardCommand)
134 self.
myList.SetValue(
"none")
144 name = str(status.name)
146 for strvals
in status.values:
147 if (strvals.key ==
"Serial Number"):
148 serial = int(strvals.value)
149 rospy.logerr(
"Adding: %s serial=%d" %(name,serial))
153 if self.
myList.Count == 1:
154 self.
myList.SetSelection(0)
175 for status
in message.status:
176 if( (status.name.startswith(
"Power board") & (self.
myList.FindString( status.name ) == wx.NOT_FOUND)) ):
181 if( status.level == 0 ):
184 elif (status.level == 0):
190 for value
in status.values:
191 if (value.key ==
"Breaker 0 Voltage"):
193 if (value.key ==
"Breaker 1 Voltage"):
195 if (value.key ==
"Breaker 2 Voltage"):
197 if (value.key ==
"RunStop Button Status"):
199 if (value.key ==
"RunStop Status"):
202 for strvals
in status.values:
203 if (re.match(
'Breaker 0',strvals.key,re.IGNORECASE)):
205 if (re.match(
'Breaker 1',strvals.key,re.IGNORECASE)):
207 if (re.match(
'Breaker 2',strvals.key,re.IGNORECASE)):
240 estop_status_temp =
"Stop" 243 estop_status_temp =
"Run" 260 except rospy.ServiceException
as e:
261 rospy.logerr(
"Service Call Failed: %s"%e)
266 except rospy.ServiceException
as e:
267 rospy.logerr(
"Service Call Failed: %s"%e)
272 except rospy.ServiceException
as e:
273 rospy.logerr(
"Service Call Failed: %s"%e)
279 except rospy.ServiceException
as e:
280 rospy.logerr(
"Service Call Failed: %s"%e)
285 except rospy.ServiceException
as e:
286 rospy.logerr(
"Service Call Failed: %s"%e)
291 except rospy.ServiceException
as e:
292 rospy.logerr(
"Service Call Failed: %s"%e)
298 except rospy.ServiceException
as e:
299 rospy.logerr(
"Service Call Failed: %s"%e)
304 except rospy.ServiceException
as e:
305 rospy.logerr(
"Service Call Failed: %s"%e)
310 except rospy.ServiceException
as e:
311 rospy.logerr(
"Service Call Failed: %s"%e)
317 except rospy.ServiceException
as e:
318 rospy.logerr(
"Service Call Failed: %s"%e)
323 except rospy.ServiceException
as e:
324 rospy.logerr(
"Service Call Failed: %s"%e)
329 except rospy.ServiceException
as e:
330 rospy.logerr(
"Service Call Failed: %s"%e)
336 except rospy.ServiceException
as e:
337 rospy.logerr(
"Service Call Failed: %s"%e)
341 except rospy.ServiceException
as e:
342 rospy.logerr(
"Service Call Failed: %s"%e)
def __init__(self, parent)
def ResetCurrent(self, event)
def EnableCB0(self, event)
def chooseBoard(self, board)
def diagnostics_callback(self, message)
def DisableCB2(self, event)
def StandbyCB2(self, event)
def ResetCB0(self, event)
def ResetTransitions(self, event)
def ResetCB1(self, event)
def DisableCB0(self, event)
def EnableCB1(self, event)
def EnableCB2(self, event)
def StandbyCB1(self, event)
def ResetCB2(self, event)
def StandbyCB0(self, event)
def DisableCB1(self, event)
def addBoard(self, status)