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)
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")
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)
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)
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)
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)
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
def trigger(self, request): message = Command.getCmd_triggerCam() LOG.log_app_info("Triggering CAM") self.writeData(message, request)