4.2.4) Autonomous Vehicle Control

Overview

Aerpawlib supports (and it always supported) relative vehicle movements.

 For example, consider the following code fragment (from aerpawlib's documentation): 

from aerpawlib.util import Coordinate, VectorNED


x = Coordinate(35.771634, -78.674109)


# get a new coord 10m north and 5m west of X

y = x + VectorNED(10, -5, 0)


# find the bearing (heading difference) between X and Y

x.bearing(y)    # -> 315 degrees


# get the vector between Y and X

vec = y - x     # -> VectorNED(-10, 5, 0)

x is initialized at an absolute location, while y is initialized at a location relative to x. The VectorNED is relative (with units meters) with the first coordinate increasing in the North direction, the second in the East direction, and the last one increasing Down (NED). All altitudes stored in a coordinate are relative to the take-off altitude.

A simple example of moving the vehicle 10m north, 5m east, and 2 m up (and waiting for it to arrive at its destination) is:

await vehicle.goto_coordinates(vehicle.position + VectorNED(10, -5, -2))

By combining relative movement with a sensing task, a simple autonomous loop may look something like this:

while (goal not yet achieved){

  perform sensing  task;

  compute new destination as a function of the sensed data;

  move vehicle to the new destination;

}

For example for searching for the location of a transmitter, the sensing task can be comparing the current signal strength with a prior value. If the current signal strength is higher than before, then the current direction may be a good direction to follow.

Safety Checker

The main problem with the basic autonomous loop presented in the previous paragraph is that the newly computed destination may not be a safe destination as far as the testbed is concerned: it may happen that a vehicle will try to follow a source of signal strength outside the boundaries of the testbed. To this end, we provide a SafetyChecker class within the aerpawlib.util package. The SafetyChecker contains a variety of useful functions primarily used by the filter to ensure the safety of vehicle commands, but the validateWaypointCommand can be used within a vehicle script to ensure a planned move would be valid. This function uses a source  and destination location and  will return true if the transition between the two points is safe, and false otherwise with the addition of a human-readable error message.

For example, given a destination coordinate, a call to:

from aerpawlib.util import SafetyChecker, Coordinate


safety_checker = SafetyChecker(vehicle_config_filepath)

(is_safe, error_message) = safety_checker.validateWaypointCommand(vehicle.position, destination)

would return true if the vehicle can safely move from its current location to destination.

Sample Application

As an example of an autonomous application, we present a simple signal strength search where an UAV is searching for a rover of unknown location by doing a sort of a gradient search. This sample application can be used as a starting point for the AFAR Challenge.