Commit Graph

56 Commits

Author SHA1 Message Date
Nick Exton c445bb5f9e AP_Common: Add same_alt_as function to Location 2023-04-04 09:40:45 +10:00
Peter Barker 1dff5b5710 AP_Common: avoid using struct Location
clang reports this could be a problem when compiling under some EABIs.  Remove it from most places as it is just noise, replace with class where we want to avoid including Location.h
2023-02-04 22:51:54 +11:00
Peter Barker 04adfc814a AP_Common: use Vector3f.xy() to avoid creating a fresh Vector2f 2022-11-16 17:59:29 +11:00
Randy Mackay 23ad8b23ac AP_Common: clarify Location::get_distance is horizontal only 2022-04-26 18:37:54 +09:00
Andrew Tridgell 8973519232 AP_Common: improved accuracy of get_bearing()
make base function ftype, then convert to int32_t for get_bearing_to()
2022-03-10 07:34:20 +11:00
Andrew Tridgell 5560dc24b5 AP_Common: removed terrain home correction 2022-03-10 07:34:20 +11:00
Shiv Tyagi 41a5afdf64 AP_Common: use default location alt frame while sanitizing location alt
We should also set alt frame along with copying altitude value while sanitizing it
2022-03-01 10:55:32 +11:00
Iampete1 407b70b82e AP_Common: location: add get alt distance method 2021-09-28 09:31:13 +10:00
Randy Mackay 70c6694798 AP_Common: add Location::linear_interpolate_alt 2021-07-22 08:51:41 +09:00
Andrew Tridgell 416c0724d2 AP_Common: use double precision for more location functions when available
this makes the location functions more accurate at long distances when
EKF double enabled
2021-07-14 17:34:40 +10:00
Andrew Tridgell 3ded1e6c10 AP_Common: added ftype precision offset call 2021-07-14 17:34:40 +10:00
Peter Barker b625596dfa AP_Common: use singleton to access AP_Terrain data 2021-07-12 17:34:44 +10:00
Andrew Tridgell 6a3b12956a AP_Common: make longitude_scale() a static
this changes the use of longitude_scale() to use the average latitude
instead of the lattitude at one end of the line when calculating
positions and distances. It means we obey the basic geometry rule
that:

 pos1 + offs = pos2
 pos2 - offs == pos1
2021-07-10 07:20:41 +10:00
Andrew Tridgell b8e42be5d1 AP_Common: added double methods for SITL 2021-07-10 07:20:41 +10:00
Andrew Tridgell 77d83b9c77 AP_Common: fixed Location class for wrap at 180 degrees longitude
this allows us to fly missions across the date line
2021-06-25 15:33:55 +10:00
Andrew Tridgell 61faeb2d7f AP_Common: added double methods for SITL 2021-06-24 21:34:30 +10:00
Pierre Kancir 983e402804 AP_Common: add more unitttests 2021-06-21 21:16:29 +10:00
Josh Henderson 206a414553 AP_Common: Location vec3 constructor zero out fields 2021-06-12 10:52:36 +09:00
Pierre Kancir ba94d8839f AP_Common: Make location PANIC message more explicit 2021-06-10 11:37:10 +10:00
Peter Barker 4abf854c45 AP_Common: remove weird cast of location object 2021-06-08 12:14:17 +10:00
Andrew Tridgell 71f207403e AP_Common: make angles in degrees end in _deg
to make it obvious it is not radians
2021-06-05 13:05:30 +10:00
Josh Henderson dce01fbb43 AP_Common: make Location(Vector3f) require ALTFRAME 2021-03-30 08:56:35 +09:00
Rishabh 55923d8b7b AP_Common: Add new method to extrapolate location from bearing and pitch 2020-08-24 08:53:20 +09:00
Peter Barker 6c0b4206c5 AP_Common: remove is-zero checks for Location::offset
Only one call in 160 actually passes these in as zeroes, so doing the
checks vastly outweighs the benefits of not doing the maths

We do call this a lot when doing terrain checks.
2019-11-19 10:49:19 +11:00
Michael du Breuil 6e0cceff0d AP_Common: Remove extra comparison from longitude_scale() 2019-06-18 10:09:09 +10:00
Peter Barker 4e5842a150 AP_Common: add initialised() method to Location
Sometimes code paths are crossed when they shouldn't be.  This method
can help in the short term if a codepath is calling methods on a
Location when it is not initialised, but generally a vehicle should be
calling position_ok() and other methods rather than this one.
2019-06-18 09:07:56 +09:00
Peter Barker ab7ee4fefb AP_Common: Location.cpp: add sanity checks 2019-05-29 09:04:37 +09:00
Pierre Kancir 4f31c3dcd5 AP_Math: move line_path_proportion to Location 2019-04-23 09:20:43 +10:00
Pierre Kancir e06d7dbbf7 AP_Math: move location_passed_point to Location and rename 2019-04-23 09:20:43 +10:00
Peter Barker 2352dd3f12 AP_Common: clean includes up in Location.h 2019-04-16 10:00:29 +10:00
Pierre Kancir 121e5d0abf AP_Math: move location_3d_diff_NED to Location and rename 2019-04-09 20:59:48 +10:00
Pierre Kancir 29b2d7996b AP_Common: move check_latlng to Location 2019-04-08 12:56:01 -07:00
Pierre Kancir b10e75f4e1 AP_Math: move locations_are_same to Location and rename to same_latlon_as 2019-04-08 08:05:05 -07:00
Pierre Kancir 00fa07ef33 AP_Math: move location_diff to Location and rename 2019-04-08 08:00:52 -07:00
Pierre Kancir a30404fb11 AP_Common: move location_update to Location and rename to offset_bearing 2019-04-06 09:10:28 +11:00
Pierre Kancir 6faf1d2849 AP_Common: move get_bearing_cd to Location and rename to get_bearing_to 2019-04-06 09:10:28 +11:00
Peter Barker fd294101ec AP_Common: Location: move sanitize to be a method on location 2019-04-02 10:19:38 +11:00
Peter Barker 22c0175d7f AP_Location: use enum class for AltFrame enumeration 2019-03-19 10:31:18 +11:00
Peter Barker a1c751919c AP_Common: move longitude_scale into Location class 2019-03-12 10:11:12 +11:00
Peter Barker 7f63720257 AP_Common: Location.cpp: force handling of all alt frames
By removing the default case we will generate a compiler error a new alt
frame is not handled
2019-03-05 10:39:29 +11:00
Peter Barker 57804e3118 AP_Common: unify Location_Class and Location 2019-01-16 11:45:29 +11:00
Peter Barker a3a012b77e AP_Common: remove packed nature of Location, move flags out of union
This saves ~2.5kB on fmuv3
2019-01-16 11:45:29 +11:00
Peter Barker dc202c1ff9 AP_Common: Location: use AP_AHRS singleton 2018-06-01 16:18:33 +01:00
Peter Barker 9a345160c1 AP_Common: fail attempts to use frame-above-home if home is not set 2018-06-01 16:18:33 +01:00
Pierre Kancir 79cd137625 AP_Common: remove AP_AHRS_NavEKF include from location class 2018-04-11 08:59:50 +09:00
Peter Barker 302e5c6871 AP_Common: have get_vector_xy_from_origin_NE take a Vector2f rather than 3f
Also, rename it from get_vector_xy_from_origin_NED
2017-12-15 01:24:13 +00:00
murata f9add59b58 Global: Aggregate the same definitions.
Global: Aggregate the same definitions.
2016-11-09 11:46:55 -03:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Tom Pittenger b78255cc25 AP_Common: avoid using AP_Math is_zero() because it is classless
- because it is classless it can not be called like AP_Math::is_zero() and will then conflict with local definition of is_zero()
2016-07-20 22:32:47 -07:00
Tom Pittenger 3edd95b99b AP_Common: add Location::is_zero and ::zero member functions 2016-07-20 22:32:47 -07:00