Exemple #1
0
 def OnMsg(self, msg):
     for i in range(len(msg.status)):
         if (msg.status[i].name == 'HysteresisTest'):
             if (msg.status[i].level == 0):
                 self.Log(msg.status[i].message)
                 self.response.status.append(msg.status[i])
                 if (self.count < self.testcount + 1):
                     mechanism.kill_controller('test_controller')
                     self.OpenXml()
                     self.Log("Starting forearm Test %s" % (self.count))
                     mechanism.spawn_controller(self.xml)
                     self.count = self.count + 1
                 else:
                     print "done"
                     self.finished = True
             else:
                 self.Log(msg.status[i].message)
                 self.response.status.append(msg.status[i])
                 self.finished = True
         elif (msg.status[i].name == 'EtherCAT Master'
               and self.ready == False):
             self.ready = True
             self.OpenXml()
             self.Log("Starting forearm Test 1")
             mechanism.spawn_controller(self.xml)
             self.count = self.count + 1
     if self.finished:
         time.sleep(2)
         for v in self.data_dict:
             print v
         mechanism.shutdown()
         self.topic.unregister()
         self.data_topic.unregister()
         self.roslaunch.stop()
         wx.CallAfter(self.FinishTest)
Exemple #2
0
 def EStop(self, evt):
   self.response.status.append(DiagnosticStatus(2, 'ESTOP',"The ESTOP button was pressed.",[],[]))
   self.Log("Emergency Stop: Ending Test.")
   mechanism.shutdown()
   self.topic.unregister()
   self.roslaunch.stop()
   wx.CallAfter(self.Done, self.response)
Exemple #3
0
 def OnMsg(self, msg):
   for i in range(len(msg.status)):
     if(msg.status[i].name=='MotorTest'):
         if(msg.status[i].level==0):
           self.Log(msg.status[i].message) 
           self.response.status.append(msg.status[i])
           if(self.count<self.testcount+1):
             mechanism.kill_controller('test_controller')
             self.OpenXml()
             self.Log("Starting Motor Test %s" % (self.count))
             mechanism.spawn_controller(self.xml)
             self.count=self.count+1
           else:
             self.finished=True
         else:
           self.Log(msg.status[i].message)
           self.response.status.append(msg.status[i])
           self.finished=True
     elif(msg.status[i].name=='EtherCAT Master' and self.ready==False):
       self.ready=True
       self.OpenXml()
       self.Log("Starting Motor Test 1")
       mechanism.spawn_controller(self.xml)
       self.count=self.count+1
   if self.finished:
     mechanism.shutdown()
     self.topic.unregister()
     self.roslaunch.stop()
     wx.CallAfter(self.Done, self.response)   
Exemple #4
0
 def OnMsg(self, msg):
   for i in range(len(msg.status)):
     if(msg.status[i].name=='HysteresisTest'):
         if(msg.status[i].level==0):
           self.Log(msg.status[i].message) 
           self.response.status.append(msg.status[i])
           if(self.count<self.testcount+1):
             mechanism.kill_controller('test_controller')
             self.OpenXml()
             self.Log("Starting forearm Test %s" % (self.count))
             mechanism.spawn_controller(self.xml)
             self.count=self.count+1
           else:
             print "done"
             self.finished=True
         else:
           self.Log(msg.status[i].message)
           self.response.status.append(msg.status[i])
           self.finished=True
     elif(msg.status[i].name=='EtherCAT Master' and self.ready==False):
       self.ready=True
       self.OpenXml()
       self.Log("Starting forearm Test 1")
       mechanism.spawn_controller(self.xml)
       self.count=self.count+1
   if self.finished:
     time.sleep(2)
     for v in self.data_dict:
       print v
     mechanism.shutdown()
     self.topic.unregister()
     self.data_topic.unregister()
     self.roslaunch.stop()
     wx.CallAfter(self.FinishTest)
Exemple #5
0
 def OnMsg(self, msg):
     for i in range(len(msg.status)):
         if (msg.status[i].name == 'MotorTest'):
             if (msg.status[i].level == 0):
                 self.Log(msg.status[i].message)
                 self.response.status.append(msg.status[i])
                 if (self.count < self.testcount + 1):
                     mechanism.kill_controller('test_controller')
                     self.OpenXml()
                     self.Log("Starting Motor Test %s" % (self.count))
                     mechanism.spawn_controller(self.xml)
                     self.count = self.count + 1
                 else:
                     self.finished = True
             else:
                 self.Log(msg.status[i].message)
                 self.response.status.append(msg.status[i])
                 self.finished = True
         elif (msg.status[i].name == 'EtherCAT Master'
               and self.ready == False):
             self.ready = True
             self.OpenXml()
             self.Log("Starting Motor Test 1")
             mechanism.spawn_controller(self.xml)
             self.count = self.count + 1
     if self.finished:
         mechanism.shutdown()
         self.topic.unregister()
         self.roslaunch.stop()
         wx.CallAfter(self.Done, self.response)
Exemple #6
0
 def EStop(self, evt):
     self.response.status.append(
         DiagnosticStatus(2, 'ESTOP', "The ESTOP button was pressed.", [],
                          []))
     self.Log("Emergency Stop: Ending Test.")
     mechanism.shutdown()
     self.topic.unregister()
     self.roslaunch.stop()
     wx.CallAfter(self.Done, self.response)
Exemple #7
0
    lc  - List active controllers
    sp  - Spawn a controller using the xml passed over stdin
    kl <name>  - Kills the controller named <name>
    shutdown - Ends whole process'''
    sys.exit(exit_code)


if __name__ == '__main__':
    if len(sys.argv) < 2:
        print_usage()
    if sys.argv[1] == 'lt':
        mechanism.list_controller_types()
    elif sys.argv[1] == 'lc':
        mechanism.list_controllers()
    elif sys.argv[1] == 'sp':
        xml = ""
        if len(sys.argv) > 2:
            f = open(sys.argv[2])
            xml = f.read()
            f.close()
        else:
            xml = sys.stdin.read()
        mechanism.spawn_controller(xml)
    elif sys.argv[1] == 'kl':
        for c in sys.argv[2:]:
            mechanism.kill_controller(c)
    elif sys.argv[1] == 'shutdown':
        mechanism.shutdown()
    else:
        print_usage(1)
Exemple #8
0
    lc  - List active controllers
    sp  - Spawn a controller using the xml passed over stdin
    kl <name>  - Kills the controller named <name>
    shutdown - Ends whole process'''
    sys.exit(exit_code)

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print_usage()
    time.sleep(2) #FIXME: added by john, this might have removed assert(robot) failure in controller initXml calls on startup. need to investigate why if any memory corruption or race condition for MC stack.
    if sys.argv[1] == 'lt':
        mechanism.list_controller_types()
    elif sys.argv[1] == 'lc':
        mechanism.list_controllers()
    elif sys.argv[1] == 'sp':
        xml = ""
        if len(sys.argv) > 2:
            f = open(sys.argv[2])
            xml = f.read()
            f.close()
        else:
            xml = sys.stdin.read()
        mechanism.spawn_controller(xml)
    elif sys.argv[1] == 'kl':
        for c in sys.argv[2:]:
            mechanism.kill_controller(c)
    elif sys.argv[1] == 'shutdown':
        mechanism.shutdown()
    else:
        print_usage(1)