num = 0 # var. is used to create numbers for plains print('====Hello====') print('Lets create a plain') while check == 'y': # main cycle answ1 = input('what kind of plain will be created ? (pass/mil)' ) # user select type of plain while answ1 != 'pass' and answ1 != 'mil': answ1 = input('try again.. (pass/mil)') if answ1 == 'pass' and answ1 == 'mil': break answ2 = input( 'what color of plain will you select ?') # user select color of plain num += 1 # generation number of plain if answ1 == 'pass': # info collected from user is used to create objects p = PassPlain(num, answ2) # p is instance of PassPlain class print(p) status = p.status else: m = MilPlain(num, answ2) # m is instance of MIlPlain class print(m) status = m.status Pilot(status) check = input('One more plain ? (y/n)') if check == 'n': break
def __init__(self, navdb): self.wind = WindSim() # Define the periodic loggers # ToDo: explain what these line sdo in comments (type of logs?) datalog.definePeriodicLogger('SNAPLOG', 'SNAPLOG logfile.', settings.snapdt) datalog.definePeriodicLogger('INSTLOG', 'INSTLOG logfile.', settings.instdt) datalog.definePeriodicLogger('SKYLOG', 'SKYLOG logfile.', settings.skydt) with RegisterElementParameters(self): # Register the following parameters for logging with datalog.registerLogParameters('SNAPLOG', self): # Aircraft Info self.id = [] # identifier (string) self.type = [] # aircaft type (string) # Positions self.lat = np.array([]) # latitude [deg] self.lon = np.array([]) # longitude [deg] self.alt = np.array([]) # altitude [m] self.hdg = np.array([]) # traffic heading [deg] self.trk = np.array([]) # track angle [deg] # Velocities self.tas = np.array([]) # true airspeed [m/s] self.gs = np.array([]) # ground speed [m/s] self.gsnorth = np.array([]) # ground speed [m/s] self.gseast = np.array([]) # ground speed [m/s] self.cas = np.array([]) # calibrated airspeed [m/s] self.M = np.array([]) # mach number self.vs = np.array([]) # vertical speed [m/s] # Atmosphere self.p = np.array([]) # air pressure [N/m2] self.rho = np.array([]) # air density [kg/m3] self.Temp = np.array([]) # air temperature [K] self.dtemp = np.array([]) # delta t for non-ISA conditions # Traffic autopilot settings self.aspd = np.array([]) # selected spd(CAS) [m/s] self.aptas = np.array([]) # just for initializing self.ama = np.array( []) # selected spd above crossover altitude (Mach) [-] self.apalt = np.array([]) # selected alt[m] self.avs = np.array([]) # selected vertical speed [m/s] # Whether to perform LNAV and VNAV self.swlnav = np.array([], dtype=np.bool) self.swvnav = np.array([], dtype=np.bool) # Flight Models self.asas = ASAS(self) self.ap = Autopilot(self) self.pilot = Pilot(self) self.adsb = ADSB(self) self.trails = Trails(self) self.actwp = ActiveWaypoint(self) # Traffic performance data self.avsdef = np.array( []) # [m/s]default vertical speed of autopilot self.aphi = np.array([]) # [rad] bank angle setting of autopilot self.ax = np.array( []) # [m/s2] absolute value of longitudinal accelleration self.bank = np.array([]) # nominal bank angle, [radian] self.hdgsel = np.array( [], dtype=np.bool) # determines whether aircraft is turning # Crossover altitude self.abco = np.array([]) self.belco = np.array([]) # limit settings self.limspd = np.array([]) # limit speed self.limspd_flag = np.array( [], dtype=np.bool ) # flag for limit spd - we have to test for max and min self.limalt = np.array([]) # limit altitude self.limvs = np.array( []) # limit vertical speed due to thrust limitation self.limvs_flag = np.array([]) # Display information on label self.label = [] # Text and bitmap of traffic label # Miscallaneous self.coslat = np.array([]) # Cosine of latitude for computations self.eps = np.array([]) # Small nonzero numbers # Default bank angles per flight phase self.bphase = np.deg2rad(np.array([15, 35, 35, 35, 15, 45])) self.reset(navdb)
from pilot import Pilot if __name__ == '__main__': p = Pilot() p.drone.land() p.drone.halt()
#!/usr/bin/env python3 # Author: Kari Lavikka import math from ev3dev.ev3 import * from time import sleep from pilot import Pilot if __name__ == "__main__": print("Kukkuu") pilot = Pilot(4.25, 14.2, LargeMotor("outA"), LargeMotor("outB")) ir = InfraredSensor() assert ir.connected, "Connect a single infrared sensor to any sensor port" ir.mode = 'IR-PROX' btn = Button() wall_distance = ir.value() print("Initial wall distance: " + str(wall_distance)) pilot.travel_indefinitely() last_blocked = pilot.get_travelled_distance() previous_print = -10000000 while True: wall_distance = ir.value()
def execute(self): if self.process and self.execute: pilot = Pilot(self.device.base_url()) pilot.inject(self.process, self.command) else: raise JobExecutionError("Process or command missing")