def main():
  mission_path = None
  if len(sys.argv) > 1:
    mission_path = sys.argv[1]
  frame = '+'
  # If we were given a mission, use its first waypoint as home.
  if mission_path:
    wploader = mavwp.MAVWPLoader()
    wploader.load(mission_path)
    wp = wploader.wp(0)
    home = mavutil.location(wp.x, wp.y, wp.z, 0)
  run_mission(mission_path, frame, home)
Exemple #2
0
# fly ArduCopter in SIL

import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, mavwp, random

# get location of scripts
testdir = os.path.dirname(os.path.realpath(__file__))

FRAME = '+'
TARGET = 'sitl'
HOME = mavutil.location(-35.362938, 149.165085, 584, 270)

homeloc = None
num_wp = 0


def hover(mavproxy, mav, hover_throttle=1300):
    mavproxy.send('rc 3 %u\n' % hover_throttle)
    return True


def calibrate_level(mavproxy, mav):
    '''init the accelerometers'''
    print("Initialising accelerometers")
    mav.calibrate_level()
    mavproxy.expect(['APM: action received', 'COMMAND_ACK'])
    return True


def arm_motors(mavproxy, mav):
Exemple #3
0
# fly ArduCopter in SIL

import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, mavwp, random

# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))

FRAME='+'
TARGET='sitl'
HOME=mavutil.location(-35.362938,149.165085,584,270)

homeloc = None
num_wp = 0

def hover(mavproxy, mav, hover_throttle=1300):
    mavproxy.send('rc 3 %u\n' % hover_throttle)
    return True

def calibrate_level(mavproxy, mav):
    '''init the accelerometers'''
    print("Initialising accelerometers")
    mav.calibrate_level()
    mavproxy.expect(['APM: action received', 'COMMAND_ACK'])
    return True

def arm_motors(mavproxy, mav):
    '''arm motors'''
    print("Arming motors")
    mavproxy.send('switch 6\n') # stabilize mode
Exemple #4
0
# drive APMrover2 in SITL

import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, random

# get location of scripts
testdir = os.path.dirname(os.path.realpath(__file__))

#HOME=mavutil.location(-35.362938,149.165085,584,270)
HOME = mavutil.location(40.071374969556928, -105.22978898137808, 1583.702759,
                        246)
homeloc = None


def drive_left_circuit(mavproxy, mav):
    '''drive a left circuit, 50m on a side'''
    mavproxy.send('switch 6\n')
    wait_mode(mav, 'MANUAL')
    mavproxy.send('rc 3 2000\n')

    print("Driving left circuit")
    # do 4 turns
    for i in range(0, 4):
        # hard left
        print("Starting turn %u" % i)
        mavproxy.send('rc 1 1000\n')
        if not wait_heading(mav, 270 - (90 * i), accuracy=10):
            return False
        mavproxy.send('rc 1 1500\n')
        print("Starting leg %u" % i)
# drive APMrover2 in SITL

import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, random

# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))


#HOME=mavutil.location(-35.362938,149.165085,584,270)
HOME=mavutil.location(40.071374969556928,-105.22978898137808,1583.702759,246)
homeloc = None

def drive_left_circuit(mavproxy, mav):
    '''drive a left circuit, 50m on a side'''
    mavproxy.send('switch 6\n')
    wait_mode(mav, 'MANUAL')
    mavproxy.send('rc 3 2000\n')

    print("Driving left circuit")
    # do 4 turns
    for i in range(0,4):
        # hard left
        print("Starting turn %u" % i)
        mavproxy.send('rc 1 1000\n')
        if not wait_heading(mav, 270 - (90*i), accuracy=10):
            return False
        mavproxy.send('rc 1 1500\n')
        print("Starting leg %u" % i)
        if not wait_distance(mav, 50, accuracy=7):
Exemple #6
0
# fly ArduCopter in SIL

import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, mavwp, random

# get location of scripts
testdir = os.path.dirname(os.path.realpath(__file__))

FRAME = '+'
TARGET = 'sitl'
HOME = mavutil.location(-35.362938, 149.165085, 584, 270)
AVCHOME = mavutil.location(40.072842, -105.230575, 1586, 0)

homeloc = None
num_wp = 0


def hover(mavproxy, mav, hover_throttle=1450):
    mavproxy.send('rc 3 %u\n' % hover_throttle)
    return True


def calibrate_level(mavproxy, mav):
    '''init the accelerometers'''
    print("Initialising accelerometers")
    mav.calibrate_level()
    mavproxy.expect(['APM: action received', 'COMMAND_ACK'])
    return True

Exemple #7
0
# fly ArduCopter in SIL

import util, pexpect, sys, time, math, shutil, os
from common import *
import mavutil, mavwp, random

# get location of scripts
testdir = os.path.dirname(os.path.realpath(__file__))

FRAME = "+"
TARGET = "sitl"
HOME = mavutil.location(-35.362938, 149.165085, 584, 270)
AVCHOME = mavutil.location(40.072842, -105.230575, 1586, 0)

homeloc = None
num_wp = 0


def hover(mavproxy, mav, hover_throttle=1450):
    mavproxy.send("rc 3 %u\n" % hover_throttle)
    return True


def calibrate_level(mavproxy, mav):
    """init the accelerometers"""
    print("Initialising accelerometers")
    mav.calibrate_level()
    mavproxy.expect(["APM: action received", "COMMAND_ACK"])
    return True