mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +08:00
refactor(navigator): define the pre-geofence by its margin alone
GF_PRE_MAX_HDIST and GF_PRE_MAX_VDIST gave the pre-geofence its own limits from Home, next to GF_PRE_MARGIN for the geofence plan. That is two ways to set one boundary, and a limit could be set outside its geofence twin. Drop the two parameters. The pre-geofence is now the geofence moved inwards by GF_PRE_MARGIN: the margin applies to GF_MAX_HOR_DIST as it does to the polygons and circles of the plan. It is horizontal only, the maximum altitude has no pre-geofence. isCloserThanMaxDistToHome() and isBelowMaxAltitude() are main's again, the first with the margin as an argument. Assisted-by: Claude:claude-fable-5-2 Signed-off-by: jonas <jonspero@me.com>
This commit is contained in:
1 parent
9c467b774e
commit
4b71fa9d3c
15 files changed
+143
-238
No files matched your search
+21
-22
@@ -207,7 +207,7 @@ In its simplest form, the perimeter is set up as a cylinder centered around the
|
||||
If the vehicle moves outside the radius or above the altitude the specified _Failsafe Action_ will trigger.
|
||||
|
||||
Note that the failsafe action will only trigger once the vehicle has already breached the geofence.
|
||||
If a boundary must not be crossed, for safety or legal reasons, configure a [Pre-Geofence](#pre-geofence).
|
||||
If a horizontal boundary must not be crossed, for safety or legal reasons, configure a [Pre-Geofence](#pre-geofence).
|
||||
It triggers its own action, for example `Hold`, before the vehicle reaches the geofence.
|
||||
|
||||

|
||||
@@ -240,7 +240,7 @@ The following settings also apply, but are not displayed in the QGC UI.
|
||||
|
||||
<Badge type="tip" text="main (PX4 v2.0)" />
|
||||
|
||||
A pre-geofence is a second set of limits inside the geofence, with its own failsafe action.
|
||||
A pre-geofence is a second boundary at a horizontal margin inside the geofence, with its own failsafe action.
|
||||
The vehicle reaches it first, so it can for example hold at the pre-geofence, and only terminate if it still crosses the geofence.
|
||||
|
||||
Use it where the geofence must not be crossed, or where the geofence action has to be severe.
|
||||
@@ -248,43 +248,43 @@ For example, under the [SORA](http://jarus-rpas.org/wp-content/uploads/2024/06/S
|
||||
|
||||
#### Pre-Geofence Setup
|
||||
|
||||
Each geofence limit has a pre-geofence twin.
|
||||
A limit that is set to 0 is disabled, and the pre-geofence is off while all of them are disabled (the default).
|
||||
The pre-geofence is off while the margin is 0 (the default).
|
||||
|
||||
| Setting | Parameter | Description |
|
||||
| ------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
|
||||
| Pre-geofence action | [GF_PRE_ACTION](../advanced_config/parameter_reference.md#GF_PRE_ACTION) | Warning, Hold mode (default), Return mode, or Land mode. |
|
||||
| Pre-geofence max radius | [GF_PRE_MAX_HDIST](../advanced_config/parameter_reference.md#GF_PRE_MAX_HDIST) | Horizontal distance from Home. Set it below `GF_MAX_HOR_DIST`. Disabled if 0. |
|
||||
| Pre-geofence max altitude | [GF_PRE_MAX_VDIST](../advanced_config/parameter_reference.md#GF_PRE_MAX_VDIST) | Altitude above Home. Set it below `GF_MAX_VER_DIST`. Disabled if 0. |
|
||||
| Pre-geofence margin | [GF_PRE_MARGIN](../advanced_config/parameter_reference.md#GF_PRE_MARGIN) | Distance from the polygons and circles of the Geofence Plan. Disabled if 0. |
|
||||
| Setting | Parameter | Description |
|
||||
| ------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------- |
|
||||
| Pre-geofence action | [GF_PRE_ACTION](../advanced_config/parameter_reference.md#GF_PRE_ACTION) | Warning, Hold mode (default), Return mode, or Land mode. |
|
||||
| Pre-geofence margin | [GF_PRE_MARGIN](../advanced_config/parameter_reference.md#GF_PRE_MARGIN) | Horizontal distance from the geofence. Disabled if 0. |
|
||||
|
||||
The margin applies to the maximum distance from Home ([GF_MAX_HOR_DIST](../advanced_config/parameter_reference.md#GF_MAX_HOR_DIST)) and to every inclusion and exclusion area of the [Geofence Plan](../flying/geofence.md#geofence-plan): the vehicle breaches the pre-geofence once it comes closer to one of them than `GF_PRE_MARGIN`.
|
||||
It is a single distance, so there is only one fence to draw and upload.
|
||||
The maximum altitude ([GF_MAX_VER_DIST](../advanced_config/parameter_reference.md#GF_MAX_VER_DIST)) has no pre-geofence.
|
||||
|
||||
The margin applies to every inclusion and exclusion area of the [Geofence Plan](../flying/geofence.md#geofence-plan): the vehicle breaches the pre-geofence once it comes closer to one of them than `GF_PRE_MARGIN`.
|
||||
It is a single distance for the whole plan, so there is only one fence to draw and upload.
|
||||
`GF_PRE_MARGIN` is only available on flight controllers that [check the mission flight path](#mission-feasibility-checks) against the geofence (not on `px4_fmu-v2`, for example).
|
||||
The others have no pre-geofence.
|
||||
|
||||

|
||||
|
||||
Leave enough room between the pre-geofence and the geofence for the vehicle to stop or turn around.
|
||||
The gap should be at least:
|
||||
The margin has to leave the vehicle enough room to stop or turn around before the geofence.
|
||||
It should be at least:
|
||||
|
||||
- Fixed-wing: The loiter radius ([NAV_LOITER_RAD](../advanced_config/parameter_reference.md#NAV_LOITER_RAD)).
|
||||
- Multicopter: The nominal stopping distance (`v^2 / 2a` with `v`=[MPC_XY_VEL_MAX](../advanced_config/parameter_reference.md#MPC_XY_VEL_MAX) and `a`=[MPC_ACC_HOR](../advanced_config/parameter_reference.md#MPC_ACC_HOR)).
|
||||
Allow additional distance for the acceleration ramp ([MPC_JERK_AUTO](../advanced_config/parameter_reference.md#MPC_JERK_AUTO)).
|
||||
|
||||
Use a gap above these nominal values to account for possible tailwind, position uncertainty, attitude tracking delay, etc.
|
||||
Use a margin above these nominal values to account for possible tailwind, position uncertainty, attitude tracking delay, etc.
|
||||
|
||||
::: info
|
||||
PX4 does not check the setup:
|
||||
|
||||
- A pre-geofence limit outside its geofence twin never comes first.
|
||||
- The pre-geofence action should be the milder of the two.
|
||||
It has no `None`, because the pre-geofence is disabled through its limits, and no `Terminate`, which is left to the geofence.
|
||||
- Keep the Return altitude ([RTL_RETURN_ALT](../advanced_config/parameter_reference.md#RTL_RETURN_ALT)) below `GF_PRE_MAX_VDIST`.
|
||||
It is measured from the destination and the limit from Home, so allow for a rally point or landing that is higher than Home.
|
||||
It has no `None`, because the pre-geofence is disabled through its margin, and no `Terminate`, which is left to the geofence.
|
||||
- If the margin leaves no room inside `GF_MAX_HOR_DIST` or inside an inclusion area, the pre-geofence is breached everywhere.
|
||||
- As for the geofence limits, a mission that is already uploaded is not checked again when these parameters change, also not while it is being flown.
|
||||
It is checked again when Mission mode is activated, or when the mission or the Geofence Plan is uploaded.
|
||||
- A geofence plan is not rejected because of the pre-geofence, for example when Home or the vehicle lies within the margin.
|
||||
If the vehicle is already outside the pre-geofence when the plan is uploaded or a parameter changes, the action is triggered at once.
|
||||
- Rally points are not checked against the pre-geofence.
|
||||
Keep them inside it: a vehicle that returns to a rally point within the margin triggers the pre-geofence action on the way there.
|
||||
|
||||
:::
|
||||
|
||||
@@ -303,11 +303,10 @@ When the vehicle breaches the pre-geofence:
|
||||
|
||||
PX4 also keeps planned flight inside the pre-geofence:
|
||||
|
||||
- A mission is rejected if one of its positions is outside the pre-geofence.
|
||||
It is also rejected if a leg between positions or a fixed-wing loiter circle comes closer to the plan than the margin.
|
||||
- A mission is rejected if one of its positions, a leg between positions or a fixed-wing loiter circle comes closer to the geofence than the margin.
|
||||
- The target of a _Go to location_ ([reposition](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_REPOSITION)) or of an altitude change, and the centre of a fixed-wing orbit or figure-eight, is refused if it lies outside the pre-geofence (unless the action is `Warning`).
|
||||
As for the geofence, only the target is checked, not the path to it or the loiter circle around it.
|
||||
An altitude change keeps the vehicle's position, so it is refused while the vehicle is horizontally outside the pre-geofence: send the vehicle back inside first.
|
||||
An altitude change keeps the vehicle's position, so it is refused while the vehicle is outside the pre-geofence: send the vehicle back inside first.
|
||||
- [Return mode](../flight_modes/return.md#geofence_awareness) plans its route around the Geofence Plan with the margin added.
|
||||
|
||||
## Position Estimation Failsafes
|
||||
|
||||
@@ -291,9 +291,6 @@ The exception is when executing a [mission path return](#rtl_type_2) from _withi
|
||||
In this case the vehicle follows mission waypoints, which we assume are planned to avoid any obstacles.
|
||||
:::
|
||||
|
||||
Keep the return altitude below the [geofence](../config/safety.md#geofence-failsafe) and [pre-geofence](../config/safety.md#pre-geofence) altitude limits ([GF_MAX_VER_DIST](../advanced_config/parameter_reference.md#GF_MAX_VER_DIST), [GF_PRE_MAX_VDIST](../advanced_config/parameter_reference.md#GF_PRE_MAX_VDIST)): a vehicle that climbs to it otherwise breaches them.
|
||||
The limits are measured from Home and the return altitude from the destination, which can be higher than Home.
|
||||
|
||||
The return altitude for a fixed-wing vehicle or a VTOL in fixed-wing mode is configured using the parameter [RTL_RETURN_ALT](#RTL_RETURN_ALT) (does not use the code described in the next paragraph).
|
||||
|
||||
The return altitude for a multicopter (or VTOL vehicle in MC mode) is configured using the parameters [RTL_RETURN_ALT](#RTL_RETURN_ALT), [RTL_CONE_ANG](#RTL_CONE_ANG), and [RTL_MIN_DIST](#RTL_MIN_DIST), which together define a half cone centered around the destination (home location or safety point).
|
||||
|
||||
@@ -145,9 +145,9 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
|
||||
### Safety
|
||||
|
||||
- [Geofence Aware Return mode](../flight_modes/return.md#geofence_awareness). ([PX4-Autopilot#27145: feat(navigator): Geofence Aware RTL](https://github.com/PX4/PX4-Autopilot/pull/27145), [PX4-Autopilot#28001: docs(navigator): [geofence] added some more warnings about limitations](https://github.com/PX4/PX4-Autopilot/pull/28001)).
|
||||
- [Pre-geofence](../config/safety.md#pre-geofence): a second set of limits inside the geofence, with its own action ([GF_PRE_ACTION](../advanced_config/parameter_reference.md#GF_PRE_ACTION)).
|
||||
- [Pre-geofence](../config/safety.md#pre-geofence): a second boundary at a horizontal margin inside the geofence ([GF_PRE_MARGIN](../advanced_config/parameter_reference.md#GF_PRE_MARGIN)), with its own action ([GF_PRE_ACTION](../advanced_config/parameter_reference.md#GF_PRE_ACTION)).
|
||||
A vehicle can for example hold at the pre-geofence, and only terminate if it still crosses the geofence.
|
||||
It is set with a maximum distance and altitude from Home ([GF_PRE_MAX_HDIST](../advanced_config/parameter_reference.md#GF_PRE_MAX_HDIST), [GF_PRE_MAX_VDIST](../advanced_config/parameter_reference.md#GF_PRE_MAX_VDIST)) and with a margin to the Geofence Plan ([GF_PRE_MARGIN](../advanced_config/parameter_reference.md#GF_PRE_MARGIN)).
|
||||
The margin applies to the maximum distance from Home and to the Geofence Plan.
|
||||
Outside the pre-geofence arming is denied, missions are rejected, and _Go to location_ targets are refused unless its action is Warning.
|
||||
Return mode plans its route with the margin added.
|
||||
- [Flight termination](../advanced_config/flight_termination.md) can now be used instead of a Descent mode as a fallback failsafe mode, allowing safer landing for unpiloted vehicles that carry a parachute.
|
||||
|
||||
Reference in new issue
Block a user