Source code for DroneProject.AbstractDrone
# -*- coding: UTF-8 -*-
#Name: James Hall
#Student No.: C00007006
#Institute: Institute of Technology Carlow
#Project: Drone Traffic Control System
#Date: April 2021
#License: GNU Affero General Public License v3.0
#Abstract Drone class
from abc import ABC, abstractmethod
[docs]class AbstractDrone(ABC):
"""
Abstract class for drone types
"""
home_latitude = 0
home_longtitude = 0
current_latitude = 0
current_longtitude = 0
destination_latitude = 0
destination_longtitude = 0
altitude = 0
battery = 100
speed = 0
flying_state = "Grounded"
drone_id = 0
drone_type = "virtual"
heading = 0
[docs] @abstractmethod
def takeoff(self):
pass
[docs] @abstractmethod
def hover(self):
pass
[docs] @abstractmethod
def moveto(self):
pass
[docs] @abstractmethod
def changealtitude(self):
pass
[docs] @abstractmethod
def land(self):
pass
[docs] @abstractmethod
def getgpsposition(self):
pass
[docs] @abstractmethod
def setdronestate(self, state):
pass
[docs] @abstractmethod
def getdronestate(self):
pass
[docs] @abstractmethod
def setbatteryinflight(self):
pass
[docs] @abstractmethod
def setbatterytotal(self, percent):
pass
[docs] @abstractmethod
def setbatterychange(self, percent):
pass
[docs] @abstractmethod
def getbattery(self):
pass
[docs] @abstractmethod
def sethomelatitude(self,lat):
pass
[docs] @abstractmethod
def gethomelatitude(self):
pass
[docs] @abstractmethod
def setdestinationlatitude(self,lat):
pass
[docs] @abstractmethod
def getdestinationlatitude(self):
pass
[docs] @abstractmethod
def setdestinationlongitude(self,lon):
pass
[docs] @abstractmethod
def getdestinationlongitude(self):
pass
[docs] @abstractmethod
def setcurrentlatitude(self,lat):
pass
[docs] @abstractmethod
def getcurrentlatitude(self):
pass
[docs] @abstractmethod
def setcurrentlongitude(self,lon):
pass
[docs] @abstractmethod
def getcurrentlongitude(self):
pass
[docs] @abstractmethod
def getdistancetodestination(self):
pass
[docs] @abstractmethod
def getdistancetoposition(self):
pass
[docs] @abstractmethod
def createvector(self):
pass
[docs] @abstractmethod
def getvectorlatitude(self):
pass
[docs] @abstractmethod
def getvectorlongitude(self):
pass
[docs] @abstractmethod
def updatecurrentposition(self):
pass
[docs] @abstractmethod
def getbearing(self, startlat, startlong, destlat, destlong):
pass
[docs] @abstractmethod
def getdronetype(self):
pass
[docs] @abstractmethod
def setdronetype(self, dronetype):
pass