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

Go to the source code of this file.

Functions

float longitude_scale (const struct Location &loc)
 
float get_distance (const struct Location &loc1, const struct Location &loc2)
 
uint32_t get_distance_cm (const struct Location &loc1, const struct Location &loc2)
 
float get_horizontal_distance_cm (const Vector3f &origin, const Vector3f &destination)
 
int32_t get_bearing_cd (const struct Location &loc1, const struct Location &loc2)
 
float get_bearing_cd (const Vector3f &origin, const Vector3f &destination)
 
bool location_passed_point (const struct Location &location, const struct Location &point1, const struct Location &point2)
 
float location_path_proportion (const struct Location &location, const struct Location &point1, const struct Location &point2)
 
void location_update (struct Location &loc, float bearing, float distance)
 
void location_offset (struct Location &loc, float ofs_north, float ofs_east)
 
Vector2f location_diff (const struct Location &loc1, const struct Location &loc2)
 
Vector3f location_3d_diff_NED (const struct Location &loc1, const struct Location &loc2)
 
bool locations_are_same (const struct Location &loc1, const struct Location &loc2)
 
bool location_sanitize (const struct Location &defaultLoc, struct Location &loc)
 
void print_latlon (AP_HAL::BetterStream *s, int32_t lat_or_lon)
 
bool check_lat (float lat)
 
bool check_lng (float lng)
 
bool check_lat (int32_t lat)
 
bool check_lng (int32_t lng)
 
bool check_latlng (float lat, float lng)
 
bool check_latlng (int32_t lat, int32_t lng)
 
bool check_latlng (Location loc)
 

Function Documentation

◆ check_lat() [1/2]

bool check_lat ( float  lat)

Definition at line 215 of file location.cpp.

Referenced by check_latlng(), AP_Mission::mavlink_int_to_mission_cmd(), and AP_Mission::mavlink_to_mission_cmd().

Here is the caller graph for this function:

◆ check_lat() [2/2]

bool check_lat ( int32_t  lat)

Definition at line 223 of file location.cpp.

◆ check_latlng() [1/3]

bool check_latlng ( float  lat,
float  lng 
)

Definition at line 231 of file location.cpp.

Referenced by AC_Fence::handle_msg(), GCS_MAVLINK::handle_rally_point(), GCS_MAVLINK::handle_set_gps_global_origin(), location_sanitize(), and GCS_MAVLINK::set_ekf_origin().

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

◆ check_latlng() [2/3]

bool check_latlng ( int32_t  lat,
int32_t  lng 
)

Definition at line 235 of file location.cpp.

Here is the call graph for this function:

◆ check_latlng() [3/3]

bool check_latlng ( Location  loc)

Definition at line 239 of file location.cpp.

Here is the call graph for this function:

◆ check_lng() [1/2]

bool check_lng ( float  lng)

Definition at line 219 of file location.cpp.

Referenced by check_latlng(), AP_Mission::mavlink_int_to_mission_cmd(), and AP_Mission::mavlink_to_mission_cmd().

Here is the caller graph for this function:

◆ check_lng() [2/2]

bool check_lng ( int32_t  lng)

Definition at line 227 of file location.cpp.

◆ get_bearing_cd() [1/2]

int32_t get_bearing_cd ( const struct Location loc1,
const struct Location loc2 
)

Definition at line 56 of file location.cpp.

Referenced by AC_WPNav::advance_wp_target_along_track(), AP_Frsky_Telem::calc_home(), AC_PosControl::get_bearing_to_target(), AP_Mission::get_next_ground_course_cd(), AC_WPNav::get_wp_bearing_to_destination(), test_one_offset(), AP_Landing::type_slope_setup_landing_glide_slope(), AP_Landing::type_slope_verify_abort_landing(), AP_Landing::type_slope_verify_land(), AP_L1_Control::update_loiter(), AP_L1_Control::update_waypoint(), and AP_Landing_Deepstall::verify_abort_landing().

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

◆ get_bearing_cd() [2/2]

float get_bearing_cd ( const Vector3f origin,
const Vector3f destination 
)

Definition at line 66 of file location.cpp.

◆ get_distance()

float get_distance ( const struct Location loc1,
const struct Location loc2 
)

Definition at line 36 of file location.cpp.

Referenced by AP_Frsky_Telem::calc_home(), AP_Rally::find_nearest_rally_point(), get_distance_cm(), AP_Mission::get_landing_sequence_start(), SITL::XPlane::receive_data(), SITL::ADSB::send_report(), test_accuracy(), test_one_offset(), AP_Landing::type_slope_adjust_landing_slope_for_rangefinder_bump(), AP_Landing::type_slope_setup_landing_glide_slope(), AP_Landing::type_slope_verify_land(), AP_Camera::update(), AP_Avoidance::update_threat_level(), and AP_Landing_Deepstall::verify_land().

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

◆ get_distance_cm()

uint32_t get_distance_cm ( const struct Location loc1,
const struct Location loc2 
)

Definition at line 44 of file location.cpp.

Referenced by AC_Fence::check_destination_within_fence().

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

◆ get_horizontal_distance_cm()

float get_horizontal_distance_cm ( const Vector3f origin,
const Vector3f destination 
)

Definition at line 50 of file location.cpp.

Here is the call graph for this function:

◆ location_3d_diff_NED()

Vector3f location_3d_diff_NED ( const struct Location loc1,
const struct Location loc2 
)

Definition at line 149 of file location.cpp.

Referenced by AP_GPS::all_consistent(), AP_AHRS_NavEKF::get_relative_position_NED_home(), and AP_Follow::get_target_dist_and_vel_ned().

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

◆ location_diff()

Vector2f location_diff ( const struct Location loc1,
const struct Location loc2 
)

◆ location_offset()

void location_offset ( struct Location loc,
float  ofs_north,
float  ofs_east 
)

Definition at line 125 of file location.cpp.

Referenced by AP_GPS::calc_blended_state(), AP_AHRS_DCM::get_position(), SoaringController::get_target(), AP_Follow::get_target_location_and_velocity(), NavEKF2_core::getLLH(), NavEKF3_core::getLLH(), location_update(), SITL::ADSB::send_report(), SITL::Aircraft::smooth_sensors(), test_one_offset(), AP_Beacon_SITL::update(), and SITL::Aircraft::update_position().

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

◆ location_passed_point()

bool location_passed_point ( const struct Location location,
const struct Location point1,
const struct Location point2 
)

Definition at line 80 of file location.cpp.

Referenced by test_passed_waypoint(), and AP_Landing_Deepstall::verify_land().

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

◆ location_path_proportion()

float location_path_proportion ( const struct Location location,
const struct Location point1,
const struct Location point2 
)

Definition at line 94 of file location.cpp.

Referenced by location_passed_point(), and AP_Landing::type_slope_setup_landing_glide_slope().

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

◆ location_sanitize()

bool location_sanitize ( const struct Location defaultLoc,
struct Location loc 
)

Definition at line 166 of file location.cpp.

Here is the call graph for this function:

◆ location_update()

void location_update ( struct Location loc,
float  bearing,
float  distance 
)

Definition at line 115 of file location.cpp.

Referenced by AP_Landing_Deepstall::build_approach_path(), AP_Proximity_SITL::get_distance_to_fence(), AP_AHRS_DCM::get_position(), AP_Landing::type_slope_setup_landing_glide_slope(), AP_Landing::type_slope_verify_land(), and AP_Landing_Deepstall::verify_land().

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

◆ locations_are_same()

bool locations_are_same ( const struct Location loc1,
const struct Location loc2 
)

Definition at line 159 of file location.cpp.

◆ longitude_scale()

float longitude_scale ( const struct Location loc)

Definition at line 27 of file location.cpp.

Referenced by get_bearing_cd(), get_distance(), Location_Class::get_distance(), Location_Class::get_vector_xy_from_origin_NE(), location_3d_diff_NED(), location_diff(), location_offset(), and Location_Class::offset().

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

◆ print_latlon()

void print_latlon ( AP_HAL::BetterStream s,
int32_t  lat_or_lon 
)

Definition at line 196 of file location.cpp.

Referenced by loop().

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