APM:Libraries
Macros | Functions | Variables
location.cpp File Reference
#include <AP_HAL/AP_HAL.h>
#include <AP_Math/AP_Math.h>
Include dependency graph for location.cpp:

Go to the source code of this file.

Macros

#define ALLOW_DOUBLE_MATH_FUNCTIONS
 
#define D2R   DEG_TO_RAD_DOUBLE
 
#define NUM_COORDS   10
 

Functions

void setup ()
 
void loop ()
 
static struct Location location_from_point (Vector2f pt)
 
static void test_passed_waypoint (void)
 
static void test_one_offset (const struct Location &loc, float ofs_north, float ofs_east, float dist, float bearing)
 
static void test_offset (void)
 
static void test_accuracy (void)
 
static void test_wrap_cd (void)
 
static void test_wgs_conversion_functions (void)
 
 AP_HAL_MAIN ()
 

Variables

const AP_HAL::HALhal = AP_HAL::get_HAL()
 -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- More...
 
struct {
   Vector2f   wp1
 
   Vector2f   wp2
 
   Vector2f   location
 
   bool   passed
 
test_points []
 
struct {
   float   ofs_north
 
   float   ofs_east
 
   float   distance
 
   float   bearing
 
test_offsets []
 
struct {
   int32_t   v
 
   int32_t   wv
 
wrap_180_tests []
 
struct {
   int32_t   v
 
   int32_t   wv
 
wrap_360_tests []
 
struct {
   float   v
 
   float   wv
 
wrap_PI_tests []
 

Macro Definition Documentation

◆ ALLOW_DOUBLE_MATH_FUNCTIONS

#define ALLOW_DOUBLE_MATH_FUNCTIONS

Definition at line 5 of file location.cpp.

◆ D2R

#define D2R   DEG_TO_RAD_DOUBLE

◆ NUM_COORDS

#define NUM_COORDS   10

Function Documentation

◆ AP_HAL_MAIN()

AP_HAL_MAIN ( )

Referenced by loop().

Here is the caller graph for this function:

◆ location_from_point()

static struct Location location_from_point ( Vector2f  pt)
static

Definition at line 42 of file location.cpp.

Referenced by test_passed_waypoint().

Here is the caller graph for this function:

◆ loop()

void loop ( void  )

Definition at line 340 of file location.cpp.

Here is the call graph for this function:

◆ setup()

void setup ( void  )

Definition at line 330 of file location.cpp.

Here is the call graph for this function:

◆ test_accuracy()

static void test_accuracy ( void  )
static

Definition at line 122 of file location.cpp.

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_offset()

static void test_offset ( void  )
static

Definition at line 102 of file location.cpp.

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_one_offset()

static void test_one_offset ( const struct Location loc,
float  ofs_north,
float  ofs_east,
float  dist,
float  bearing 
)
static

Definition at line 65 of file location.cpp.

Referenced by test_offset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_passed_waypoint()

static void test_passed_waypoint ( void  )
static

Definition at line 50 of file location.cpp.

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_wgs_conversion_functions()

static void test_wgs_conversion_functions ( void  )
static

Definition at line 241 of file location.cpp.

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_wrap_cd()

static void test_wrap_cd ( void  )
static

Definition at line 206 of file location.cpp.

Referenced by setup().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ bearing

float bearing

Definition at line 94 of file location.cpp.

Referenced by get_bearing_cd(), test_offset(), and test_one_offset().

◆ distance

float distance

◆ hal

const AP_HAL::HAL& hal = AP_HAL::get_HAL()

-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-

The strategy for roll/pitch autotune is to give the user a AUTOTUNE flight mode which behaves just like FBWA, but does automatic tuning.

While the user is flying in AUTOTUNE the gains are saved every 10 seconds, but the saved gains are not the current gains, instead it saves the gains from 10s ago. When the user exits AUTOTUNE the gains are restored from 10s ago.

This allows the user to fly as much as they want in AUTOTUNE mode, and if they are ever unhappy they just exit the mode. If they stay in AUTOTUNE for more than 10s then their gains will have changed.

Using this approach users don't need any special switches, they just need to be able to enter and exit AUTOTUNE mode

Definition at line 13 of file location.cpp.

◆ location

Vector2f location

◆ ofs_east

float ofs_east

Definition at line 94 of file location.cpp.

Referenced by location_update(), Location_Class::set_terrain(), and test_offset().

◆ ofs_north

float ofs_north

Definition at line 94 of file location.cpp.

Referenced by location_update(), Location_Class::set_terrain(), and test_offset().

◆ passed

bool passed

◆ test_offsets

const { ... } test_offsets[]
Initial value:
= {
{ 1000.0f, 1000.0f, sqrtf(2.0f) * 1000.0f, 45.0f },
{ 1000.0f, -1000.0f, sqrtf(2.0f) * 1000.0f, -45.0f },
{ 1000.0f, 0.0f, 1000.0f, 0.0f },
{ 0.0f, 1000.0f, 1000.0f, 90.0f },
}
#define f(i)

Referenced by test_offset().

◆ test_points

const { ... } test_points[]
Initial value:
= {
{ Vector2f(-35.3647759314918f, 149.16265692810987f),
Vector2f(-35.36279922658029f, 149.16352169591426f),
Vector2f(-35.36214956969903f, 149.16461410046492f), true },
{ Vector2f(-35.36438601157189f, 149.16613916088568f),
Vector2f(-35.364432558610254f, 149.16287313113048f),
Vector2f(-35.36491510034746f, 149.16365837225004f), false },
{ Vector2f(0.0f, 0.0f),
Vector2f(0.0f, 1.0f),
Vector2f(0.0f, 2.0f), true },
{ Vector2f(0.0f, 0.0f),
Vector2f(0.0f, 2.0f),
Vector2f(0.0f, 1.0f), false },
{ Vector2f(0.0f, 0.0f),
Vector2f(1.0f, 0.0f),
Vector2f(2.0f, 0.0f), true },
{ Vector2f(0.0f, 0.0f),
Vector2f(2.0f, 0.0f),
Vector2f(1.0f, 0.0f), false },
{ Vector2f(0.0f, 0.0f),
Vector2f(-1.0f, 1.0f),
Vector2f(-2.0f, 2.0f), true },
}
Vector2< float > Vector2f
Definition: vector2.h:239
#define f(i)

Referenced by test_passed_waypoint().

◆ v

float v

Definition at line 183 of file location.cpp.

Referenced by test_accuracy(), and test_wrap_cd().

◆ wp1

Vector2f wp1

Definition at line 16 of file location.cpp.

◆ wp2

Vector2f wp2

Definition at line 16 of file location.cpp.

◆ wrap_180_tests

const { ... } wrap_180_tests[]
Initial value:
= {
{ 32000, -4000 },
{ 1500 + 100*36000, 1500 },
{ -1500 - 100*36000, -1500 },
}

Referenced by test_wrap_cd().

◆ wrap_360_tests

const { ... } wrap_360_tests[]
Initial value:
= {
{ 32000, 32000 },
{ 1500 + 100*36000, 1500 },
{ -1500 - 100*36000, 34500 },
}

Referenced by test_wrap_cd().

◆ wrap_PI_tests

const { ... } wrap_PI_tests[]
Initial value:
= {
{ 0.2f*M_PI, 0.2f*M_PI },
{ 0.2f*M_PI + 100*M_PI, 0.2f*M_PI },
{ -0.2f*M_PI - 100*M_PI, -0.2f*M_PI },
}
#define M_PI
Definition: definitions.h:10

Referenced by test_wrap_cd().

◆ wv

float wv

Definition at line 183 of file location.cpp.

Referenced by test_wrap_cd().