def range_limit(current, target): return limiter(-0.2, 0.2)(proportional(0.1 / 50.0)(current, target))
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) rocky.ctrl.atp('Move Up') rocky.nav.vnav(method=proportional(0.25), tolerance=0.5).up(10) lnav = rocky.nav.lnav(method=proportional(0.20), tolerance=0.5) yaw = rocky.nav.rotate(method=range_limit, tolerance=2) rocky.ctrl.atp('First') for _ in range(4): lnav.forward(15) yaw.clockwise(90) rocky.ctrl.atp('Second') for _ in range(4): lnav.forward(15) yaw.counterclockwise(90) rocky.ctrl.atp('Third')
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) vnav = rocky.nav.vnav(method=proportional(0.25), tolerance=0.5) lnav = rocky.nav.lnav(method=proportional(0.20), tolerance=0.5) rocky.ctrl.atp('Move Up') vnav.up(10) rocky.ctrl.atp('Vertical Right') vnav.up(10) lnav.right(15) vnav.down(15, method=proportional(0.30)) lnav.left(15) rocky.ctrl.atp('Vertical Left') vnav.up(15) lnav.left(15) vnav.down(15, method=proportional(0.30))
from time import sleep from pyliner.app.communication import Communication from pyliner.navigation.control import proportional from pyliner.vehicle import Vehicle from pyliner.util import from pyliner.util.scripting_wrapper import ScriptingWrapper from pyliner.util.periodic_executor import PeriodicExecutor SLEEP = 0.1 HALF_X = 400 / 2 HALF_Y = 400 / 2 TARGET_DISTANCE = 10 # Need to scale [-200, 200] to [-1, 1] rotator = proportional(1.0 / 200.0) # Scale distance by some factor lnav = proportional(1.0 / 10.0) # TODO OpenCV initialization here rocky = ScriptingWrapper(Vehicle( vehicle_id='rocky', communications=Communication( airliner_map=read_json("airliner.json"), ci_port=5009, to_port=5012) ))
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) rocky.ctrl.atp('Move Up') rocky.nav.vnav(method=proportional(0.25), tolerance=0.5) \ .up(10) rocky.ctrl.atp('First') lnav = rocky.nav.lnav(method=proportional(0.20), tolerance=0.5) lnav.forward(15) lnav.right(15) lnav.backward(15) lnav.left(15) rocky.ctrl.atp('Second') lnav.forward(15) lnav.left(15) lnav.backward(15) lnav.right(15)