示例#1
0
文件: UAV.py 项目: RManuM/UAV-RC
 def connectSerial(self, comport, autopublish):
     self.drone = AscTec(self)
     try:
         result = self.drone.connectDrone(comport, autopublish=autopublish)
     except Exception, e:
         print UAV_Logger.log_error("Comport not opened: " + str(e))
         sys.exit(1)
示例#2
0
文件: UAV.py 项目: RManuM/UAV-RC
class UAV(AClient):
    """
    A UAV-AscTec connecting to serial socket
    """

    def __init__(self, host, port):
        """
        Constructor initailising UAV
        Setting up a Socket.io-Socket
        Setting up the Serial Socket
        """
        SLOTS.extend(ASCTEC_SLOTS)
        super(UAV, self).__init__(host, port, MODULE_NAME, SLOTS, SIGNALS)
        self.drone = None

    def __notImplementedAcknowledge(self, request):
        if request.isAckRequired():
            self._acknowledgeSignal(request, error_code=666, error_description="not implemented yet")

    def ack_positive(self, request):
        self._acknowledgeSignal(request, data={})

    def ack_error(self, request, error_code, error_description):
        self._acknowledgeSignal(request, error_code, error_description)

    def connectSerial(self, comport, autopublish):
        self.drone = AscTec(self)
        try:
            result = self.drone.connectDrone(comport, autopublish=autopublish)
        except Exception, e:
            print UAV_Logger.log_error("Comport not opened: " + str(e))
            sys.exit(1)
        return result