How to use the pymavlink.mavutil.location function in pymavlink

To help you get started, we’ve selected a few pymavlink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github squaresLab / BugZoo / robots / ardurover / demo / test-harness.py View on Github external
NUM_WAYPOINTS = {
    'good1': 5,
    'good2': 5,
    'good3': 6,
    'bad1': 5,
    'bad2': 5
}


END_LOCATION = {
    'good1': mavutil.location(37.9941253662109375, -78.39752197265625, 7299957275390625, 180),
    'good2': mavutil.location(37.9942436218261719, -78.3973541259765625, 7299957275390625, 180),
    'good3': mavutil.location(37.99408531188965, -78.39767837524414, 7299957275390625, 180),
    'bad1': mavutil.location(37.9941253662109375, -78.39752197265625, 7299957275390625, 180),
    'bad2': mavutil.location(37.9941253662109375, -78.39752197265625, 7299957275390625, 180)
}


def wait_ready_to_arm(mavproxy):
    # wait for EKF and GPS checks to pass
    mavproxy.expect('IMU0 is using GPS')


def arm_rover(mavproxy, mav):
    wait_ready_to_arm(mavproxy);

    mavproxy.send('arm throttle\n')
    mavproxy.expect('ARMED')

    print("ROVER ARMED")
github ArduPilot / ardupilot / Tools / autotest / apmrover2.py View on Github external
def test_rally_points(self):
        self.reboot_sitl() # to ensure starting point is as expected

        self.load_rally("rover-test-rally.txt")
        accuracy = self.get_parameter("WP_RADIUS")

        self.wait_ready_to_arm()
        self.arm_vehicle()

        self.reach_heading_manual(10)
        self.reach_distance_manual(50)

        self.change_mode("RTL")
        # location copied in from rover-test-rally.txt:
        loc = mavutil.location(40.071553,
                               -105.229401,
                               0,
                               0)
        self.wait_location(loc, accuracy=accuracy)
        self.disarm_vehicle()
github squaresLab / BugZoo / robots / ardurover / original-test-harness.py View on Github external
import sys
import os
import pexpect
import time
import shutil

from pymavlink import mavutil, mavwp

# import autotest modules
testdir = os.path.abspath("source/Tools/autotest")
sys.path.append(testdir)

from common import *
from pysim import util, vehicleinfo

HOME = mavutil.location(40.071374969556928, -105.22978898137808, 1583.702759, 246)
homeloc = None

def wait_ready_to_arm(mavproxy):
    # wait for EKF and GPS checks to pass
    mavproxy.expect('IMU0 is using GPS')


def arm_rover(mavproxy, mav):
    wait_ready_to_arm(mavproxy);

    mavproxy.send('arm throttle\n')
    mavproxy.expect('ARMED')

    print("ROVER ARMED")
    return True
github ArduPilot / ardupilot / Tools / autotest / common.py View on Github external
def sim_location(self):
        """Return current simulator location."""
        m = self.mav.recv_match(type='SIMSTATE', blocking=True)
        return mavutil.location(m.lat*1.0e-7,
                                m.lng*1.0e-7,
                                0,
                                math.degrees(m.yaw))
github ArduPilot / ardupilot / Tools / autotest / ardusub.py View on Github external
#!/usr/bin/env python

# Dive ArduSub in SITL
from __future__ import print_function
import os

from pymavlink import mavutil

from common import AutoTest
from common import NotAchievedException

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

SITL_START_LOCATION = mavutil.location(33.810313, -118.393867, 0, 185)


class Joystick():
    Pitch = 1
    Roll = 2
    Throttle = 3
    Yaw = 4
    Forward = 5
    Lateral = 6


class AutoTestSub(AutoTest):
    @staticmethod
    def get_not_armable_mode_list():
        return []
github ArduPilot / ardupilot / Tools / autotest / quadplane.py View on Github external
# Fly ArduPlane QuadPlane in SITL
from __future__ import print_function
import os
from pymavlink import mavutil

from common import AutoTest
from common import AutoTestTimeoutException

from pysim import vehicleinfo
import operator


# get location of scripts
testdir = os.path.dirname(os.path.realpath(__file__))
SITL_START_LOCATION = mavutil.location(-27.274439, 151.290064, 343, 8.7)
MISSION = 'ArduPlane-Missions/Dalby-OBC2016.txt'
FENCE = 'ArduPlane-Missions/Dalby-OBC2016-fence.txt'
WIND = "0,180,0.2"  # speed,direction,variance


class AutoTestQuadPlane(AutoTest):
    @staticmethod
    def get_not_armable_mode_list():
        return []

    @staticmethod
    def get_not_disarmed_settable_modes_list():
        return []

    @staticmethod
    def get_no_position_not_settable_modes_list():
github ArduPilot / MAVProxy / MAVProxy / modules / mavproxy_wp.py View on Github external
def get_loc(self, m):
        '''return a mavutil.location for item m'''
        t = m.get_type()
        if t == "MISSION_ITEM":
            lat = m.x * 1e7
            lng = m.y * 1e7
            alt = m.z * 1e2
        elif t == "MISSION_ITEM_INT":
            lat = m.x
            lng = m.y
            alt = m.z
        else:
            return None
        return mavutil.location(lat, lng, alt)
github ArduPilot / ardupilot / Tools / run_sim_mission.py View on Github external
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)