Esempio n. 1
0
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)

    rocky.ctrl.atp('Move Up')
Esempio n. 2
0
from pyliner.vehicle import Vehicle
from pyliner.util import read_json
from pyliner.util.scripting_wrapper import ScriptingWrapper

FAST = 0.75
SLOW = 0.50
SLEEP = 0.1


def range_limit(current, target):
    return limiter(0, 0.25)(proportional(0.1 / 50.0)(current, target))


rky = Vehicle(vehicle_id='rocky',
              communications=Communication(
                  airliner_map=read_json("airliner.json"),
                  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=constant(0.5), tolerance=0.5).up(10)