Commit Graph

64 Commits

Author SHA1 Message Date
James O'Shannessy c316711351 ArduPlane: Add conversion from ArduPlane geofence param to AC_Fence param 2021-03-05 14:52:46 +11:00
James O'Shannessy b6d29d746b AC_Fence: Add common auto enable and auto disable 2021-03-05 14:52:46 +11:00
Dr.-Ing. Amilcar Do Carmo Lucas 22bdc3e54c AC_Fence: extend pre-arm checks
Fix comments
2021-03-05 14:52:46 +11:00
Dr.-Ing. Amilcar do Carmo Lucas 2e422f249a AC_Fence: small comment improvements. Do not call the same function four times 2021-03-05 14:52:46 +11:00
Dr.-Ing. Amilcar do Carmo Lucas 15e95be7d7 AC_Fence: do not delete the FENCE_ENABLE parameter. It would confuse many users.
Talked to Randy about this. The consensus was not to delete the parameter
2021-03-05 14:52:46 +11:00
James O'Shannessy 783a4b7965 AC_Fence: Change logic to fence enable and sys_status reporting 2021-03-05 14:52:46 +11:00
James O'Shannessy 87b66b4b49 AC_Fence: Add parameters from Geofence to AC_Fence
AC_Fence: Add fence floor breach checks and calculations

AC_Fence: Add event logging to enable/disable of fence floor

AC_Fence: Adjust sys_status reporting to look at total fence count

AC_Fence: Make retrieving of the return point accessible

AC_Fence: Check whether fence is enabled or autoenable is set for arming checks

Checks whether the fence is currently enabled OR if the fence is intended to be enabled automatically.
These checks are used to find out enabled fences, or prearm checks
2021-03-05 14:52:46 +11:00
murata 3824277d11 AC_Fence: Add Smart RTL or LAND to the fence action 2021-03-03 07:59:03 +09:00
Peter Barker a0172fd2ca AC_Fence: emit a FENCE_STATUS message if we newly-breach the fences
This should resolve a problem in autotest where we don't detect the
fence as being breached as ArduPilot never announces the fact it has
breached - it just changes mode to RTL but the interval on the
FENCE_STATUS message never aligns with the time the vehicle is breached.
2021-02-23 08:28:02 +09:00
Peter Barker 714a3e2462 AC_Fence: support for multiple polygon fences
AC_Fence: add interface for retrieving exclusion polygons

AC_Fence: add interface to get exlusion polygons to polyfence loader

AC_Fence: add suport for inclusion circles

AC_Fence: add option for compiling-out FENCE_POINT protocol support

AC_Fence: get_exclusion_polygon and get_boundary_points set num_points to zero on failure

AC_Fence: use Debug(...) to hide debug messages

AC_PolyFence_loader: add methods to retrieve all inclusion zones

AC_PolyFence_loader: valid simply returns true if a polygon boundary can be returned

AC_Fence: add get_exclusion_circle

AC_Fence: add get_exclusion_circle_update_ms accessor

AC_Fence: PolyFence_loader gets inclusion circle accessors

AC_PolyFence_loader: add and use semaphore to protect loaded fence

AC_Fence: move fence breach check below fence type checks

This allows us to provide more information to the user about why they
are breached.

For example, if the radius is negative you are considered in breach of
it - but we'd tell you you were breached, not that your radius was
invalid

AC_Fence: clear the fence if we discover the user has set the fence count to zero
2019-09-28 07:58:48 +09:00
Peter Barker ff37590776 AC_Fence: move polygon points into AC_Fence_Polygon 2019-09-28 07:58:48 +09:00
Peter Barker a5ec64fc99 AC_Fence: tidy get_breach_distance
The polygon fence will soon be able to supply a breach distance -
prepare for that.
2019-08-08 16:47:41 +09:00
Pierre Kancir bf74cb4e99 AC_Fence: pass mavlink_message_t by const reference 2019-07-16 20:51:42 +10:00
Randy Mackay beb9ecbdcb AC_Fence: add get_boundary_update_ms
this allows callers to detect changes in the underlying polygon fence
2019-06-11 13:13:22 +09:00
Randy Mackay 0f6e61bc33 AC_Fence: add is_polygon_valid accessor 2019-06-11 13:13:22 +09:00
Peter Barker 062ee71135 AC_Fence: simplify fence loading
There's only one caller to this, who didn't force loading - so remove
the unused parameter.

Also remove the _boundary_loaded boolean; it was only set to true in one
place - just before the sole caller called the function!
2019-05-30 16:03:58 +09:00
Peter Barker 2822c635ec AC_Fence: correct get_boundary_points to account for closing point
Also rename from get_polygon_points
2019-05-29 15:34:02 +10:00
Peter Barker 8991fd8fcf AC_Fence: clear breaches if boundary invalid etc 2019-03-08 08:57:27 +09:00
Peter Barker 7198234a44 AC_Fence: clean headers 2019-02-19 09:16:26 +11:00
Peter Barker a52a1f710f AC_Fence: add singleton (AP::fence()) 2019-01-31 13:44:29 +09:00
Peter Barker 6313cbca0b AC_Fence: stop taking reference to AHRS in constructor 2019-01-31 11:25:38 +09:00
chobitsfan e7f87f767a AC_Fence: add SmartRTL and Brake actions 2019-01-25 15:43:18 +09:00
Peter Barker 9deee2a805 AP_Fence: adjust for Location_Class and Location unification 2019-01-16 11:45:29 +11:00
Peter Barker c4bee518bb AC_Fence: rename send_extended_status1 to send_sys_status 2018-12-10 12:52:41 +09:00
Raouf e55369b1c8 AC_Fence: add always land option 2018-07-26 10:08:45 +09:00
Peter Barker e30a6bbce3 AC_Fence: rename sys_status methods from geofence_ to sys_status_ 2018-01-09 17:15:19 +00:00
Peter Barker a5aafab7ff AC_Fence: use pre-arm checks for sanity checks
Magically resetting people's parameters not a great look.
2018-01-09 17:15:19 +00:00
Peter Barker 155407956c AC_Fence: add a pre-arm check for polygon fence validity
Also change SYS_STATUS bit to be unhealthy if boundary invalid
2018-01-09 17:15:19 +00:00
Peter Barker 588b0c17c8 AC_Fence: remove AC_FENCE_TYPE_NONE define
0 is the appropriate value for a bitmask which is empty
2017-12-28 15:38:37 +00:00
Peter Barker aa482bae40 AC_Fence: remove argument to check()
Also, rename check_fence() to check()
2017-12-28 15:38:37 +00:00
Peter Barker 0f94fde434 AC_Fence: get home distance directly from ahrs 2017-12-15 01:42:49 +00:00
Andrew Tridgell 25b9a7e711 AC_Fence: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Peter Barker 1ecfdffa76 AC_Fence: methods to help populate SYS_STATUS 2017-12-13 10:04:50 +09:00
Peter Barker ac3f030a34 AC_Fence: factor out check_fence_alt_max
NFC
2017-12-13 10:04:50 +09:00
Peter Barker d04a4dd0f8 AC_Fence: factor out check_fence_circle
NFC
2017-12-13 10:04:50 +09:00
Peter Barker d379c7bbd9 AC_Fence: factor out check_fence_polygon
NFC
2017-12-13 10:04:50 +09:00
khancyr 65373b85f0 AC_Fence: replace AP_InertialNav by AHRS 2017-12-13 10:04:50 +09:00
Lucas De Marchi 52686ec838 AC_Fence: add static create method 2017-09-26 03:01:21 +01:00
khancyr f583121433 AC_Fence: reset fences breach on disable
Also rename enable function parameter
2017-07-27 20:41:40 +09:00
Peter Barker ae6df4fc04 AC_Fence: remove global static send_statustext_chan 2017-07-11 23:53:53 +01:00
Randy Mackay c1a25c25f7 AC_Fence: return failure message 2017-03-25 10:50:58 +09:00
Jacob Walser 3c6df7cc0e AC_Fence: Add minimum altitude limit
get_safe_alt() -> get_safe_alt_max() and get_safe_alt_min()
2017-02-21 11:26:14 +11: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
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Peter Barker d188504b8b AC_Fence: remove unused variable _boundary_revalidate 2016-10-24 08:57:56 -02:00
Randy Mackay e820506c5a AC_Fence: add polygon fence check to check_destination_within_fence 2016-07-04 18:25:03 +09:00
Randy Mackay 5153c3d195 AC_Fence: merge with add polygon support 2016-06-25 15:55:55 +09:00
Randy Mackay d91805edbf AC_Fence: add support for polygon fences 2016-06-25 15:55:55 +09:00
Daniel Ricketts e60710332b AC_Fence: add accessors to return radius and safety margin 2016-06-22 11:38:15 +09:00
Randy Mackay 4829dbb55d AC_Fence: rename check_destination_within_fence and accept distances in meters 2016-05-21 09:56:12 +09:00