Commit Graph

66 Commits

Author SHA1 Message Date
Peter Barker 1d945cc5ac AP_Common: Location: allow retrieval of Vector3p from vector-from-origin 2024-06-11 19:50:18 +10:00
Peter Barker 911375fa9a AP_Common: rearrange get_vector_from_origin_NEU to be less destructive
this change means that if the origin call failes we don't half-update the object before returning false
2024-06-11 09:47:14 +10:00
Andrew Tridgell aa2f885e2f AP_Common: added checks for new without std::nothrow
and add NEW_NOTHROW macro
2024-06-04 09:20:21 +10:00
Iampete1 1b1ce9530c AP_Common: add `get_distance_NED_alt_frame` method 2024-04-30 08:03:39 +09:00
Peter Barker 44359ff6b2 AP_Common: add get_alt - 100 times better than get_alt_cm 2024-04-16 19:14:12 +10:00
Peter Barker 5488ca6403 AP_Common: add ASSERT_STORAGE_SIZE macro
saves havin gto name the dummy variable yourself
2024-01-22 22:44:05 +11:00
Mykhailo Kuznietsov 4e7d5e9ecf AP_Common: Fix some typos
Fixed some typos found in the code.
2023-10-12 18:30:42 +11:00
Peter Barker 61be71eea6 AP_Common: make Location.cpp compile without AP::ahrs() available 2023-10-04 18:10:58 +11:00
Peter Barker 72f485b5a5 AP_Common: remove unused Location constructor from Vector3d
Replaced with AHRS method
2023-09-12 09:29:26 +10:00
Peter Barker a9c62fa565 AP_Common: Location: add offset(Vector3p &ned_offset) 2023-09-12 09:29:26 +10:00
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