Exemple #1
0
 def _pollData(self):
     while self.connected:
         self.writeData(Command.getCmd_poll(LLSTATUS, IMUCALC, GPS, GPSADV, CAM))
         if self.__onMission:
             print "POLL CURWAY"
             self.writeData(Command.getCmd_poll(CURWAY))
         time.sleep(self.__pollIntervall)
Exemple #2
0
 def setCamAngle(self, pitch, roll, request):
     LOG.log_app_info("Setting angle to (pitch/roll): (" + str(pitch) + "/" + str(roll) + ")")
     key = "CAM"
     if not self.__pending_acks.has_key(key):
         self.__pending_acks[key] = request
         self.writeData(Command.getCmd_setCam(pitch, roll))
     else:
         self.abstractUAV.ack_error(request, 1, "already pending action")
Exemple #3
0
 def comeHome(self, request):
     """flies to the current home-position"""
     command = Command.getCmd_comeHome()
     self.writeData(command)
     key = "COMEHOME"
     if not self.__pending_acks.has_key(key):
         self.__pending_acks[key] = request
     self.__onMission = True ## FIXME: curway checking?
     LOG.log_app_info(key)
Exemple #4
0
 def endFlight(self, request):
     """ ends a flight"""
     command = Command.getCmd_endFlight()
     self.writeData(command)
     key = "ENDFLIGHT"
     if not self.__pending_acks.has_key(key):
         self.__pending_acks[key] = request
     self.__onMission = True ## FIXME: curway checking?
     LOG.log_app_info(key)
Exemple #5
0
 def launch(self, target, request):
     """ Setting the current home-position"""
     command = Command.getCmd_launch()
     self.writeData(command)
     key = "LAUNCH"
     if not self.__pending_acks.has_key(key):
         self.__pending_acks[key] = request
     self.__onMission = True ## FIXME: curway checking?
     LOG.log_app_info(key)
Exemple #6
0
 def goto(self, target, request):
     """keeping the target but moving to a different point for resuming"""
     maxSpeed= 10 ## in m/s
     timeToStay=1 ## in s
     acc=2 ## in m
     lng=float(target["lon"])
     lat=float(target["lat"])
     heading=float(target["heading"])
     height=float(target["alt"])
     command = Command.getCmd_goto(maxSpeed,timeToStay,acc,lng,lat,heading,height)
     self.writeData(command)
     key = "GOTO"
     if not self.__pending_acks.has_key(key):
         self.__pending_acks[key] = request
     self.__onMission = True ## FIXME: curway checking?
     LOG.log_app_info(key)
Exemple #7
0
 def setTarget(self, target, request):
     self._target = target
     ## setting cam
     pitch = float(request.get("body","cam", "pitch"))
     roll = float(request.get("body","cam", "roll"))
     self.setCamAngle(pitch, roll, request)
     
     ## setting waypoint FIXME: setting some values not statically
     LOG.log_app_info("Setting target.")
     maxSpeed= 10 ## in m/s
     timeToStay=1 ## in s
     acc=2 ## in m
     lng=float(target["lon"])
     lat=float(target["lat"])
     heading=float(target["heading"])
     height=float(target["alt"])
     flags = str(request.get("body", "cam", "trigger")).lower() == "true"
     command = Command.getCmd_uploadTarget(maxSpeed, timeToStay, acc, lng, lat, heading, height, flags)
     self.writeData(command)
     key = "WPT"
     if not self.__pending_acks.has_key(key):
         self.__pending_acks[key] = request
     self.__onMission = True
Exemple #8
0
 def trigger(self, request):
     message = Command.getCmd_triggerCam()
     LOG.log_app_info("Triggering CAM")
     self.writeData(message, request)