from pyliner.app.communication import Communication from pyliner.app.controller import FlightMode from pyliner.navigation.control import limiter, proportional from pyliner.vehicle import Vehicle from pyliner.util import read_json from pyliner.util.scripting_wrapper import ScriptingWrapper def range_limit(current, target): return limiter(-0.2, 0.2)(proportional(0.1 / 50.0)(current, target)) rky = Vehicle(vehicle_id='rocky', communications=Communication( airliner_map=read_json("airliner.json"), address="192.168.1.2", ci_port=5009, to_port=5012)) with ScriptingWrapper(rky) as rocky: while rocky.nav.altitude == "NULL": sleep(1) print "Waiting for telemetry downlink..." rocky.ctrl.atp('Arm') rocky.ctrl.arm() rocky.ctrl.atp('Takeoff') rocky.ctrl.takeoff() rocky.ctrl.flight_mode(FlightMode.PosCtl)
from pyliner.app.communication import Communication from pyliner.util import read_json from pyliner.util.scripting_wrapper import ScriptingWrapper from pyliner.vehicle import Vehicle vehicle = Vehicle(vehicle_id='rocky', communications=Communication( airliner_map=read_json('airliner.json'), address="192.168.1.2", ci_port=5009, to_port=5012)) with ScriptingWrapper(vehicle) as rocky: geo = rocky.geographic # Takeoff rocky.ctrl.atp('Begin Mission') rocky.ctrl.arm() rocky.ctrl.takeoff() # Generate waypoints last = rocky.nav.position last.altitude += 10 wpts = [] motion = [(0, 30), (90, 10), (180, 30), (90, 10), (0, 30), (90, 10), (180, 30), (90, 10), (0, 30), (90, 10), (180, 30)] for brng, dist in motion: last = geo.pbd(last, brng, dist) wpts.append(last) # Goto