forked from iNavFlight/inav
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request iNavFlight#5 from iNavFlight/master
merge master
- Loading branch information
Showing
92 changed files
with
2,511 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# INav - Safehomes | ||
|
||
## Introduction | ||
|
||
The "Home" position is used for the landing point when landing is enabled or in an emergency situation. It is usually determined by the GPS location where the aircraft is armed. | ||
|
||
For airplanes, the landing procedure is explained very well by Pawel Spychalski [here.](https://quadmeup.com/inav-1-8-automated-landing-for-fixed-wings/) | ||
|
||
<img src="https://quadmeup.com/wp-content/uploads/2017/06/fixed-wing-landing-1024x683.png" width="600"> | ||
|
||
One potential risk when landing is that there might be buildings, trees and other obstacles in the way as the airplance circles lower toward the ground at the arming point. Most people don't go the middle of the field when arming their airplanes. | ||
|
||
## Safehome | ||
|
||
Safehomes are a list of GPS coordinates that identify safe landing points. When the flight controller is armed, it checks the list of safehomes. The first one that is enabled and within 200m of the current position will be selected. Otherwise, it reverts to the old behaviour of using your current GPS position as home. | ||
|
||
You can define up to 8 safehomes for different locations you fly at. | ||
|
||
When you are choosing safehome locations, ensure that the location is clear of obstructions for a radius more than 50m (`nav_fw_loiter_radius`). As the plane descends, the circles aren't always symmetrical, as wind direction could result in some wider or tighter turns. Also, the direction and length of the final landing stage is also unknown. You want to choose a point that has provides a margin for variation and the final landing. | ||
|
||
## OSD Message when Armed | ||
|
||
When the aircraft is armed, the OSD briefly shows `ARMED` and the current GPS position and current date and time. | ||
|
||
If a safehome is selected, an additional message appears: | ||
``` | ||
H - DIST -> SAFEHOME n <- New message | ||
n is the Safehome index (0-7) | ||
ARMED DIST is the distance from | ||
GPS LATITUDE your current position to this safehome | ||
GPS LONGITUDE | ||
GPS PLUS CODE | ||
CURRENT DATE | ||
CURRENT TIME | ||
``` | ||
The GPS details are those of the selected safehome. | ||
To draw your attention to "HOME" being replaced, the message flashes and stays visible longer. | ||
|
||
## CLI command `safehome` to manage safehomes | ||
|
||
`safehome` - List all safehomes | ||
|
||
`safehome reset` - Clears all safehomes. | ||
|
||
`safehome <n> <enabled> <lat> <lon>` - Set the parameters of a safehome with index `<n>`. | ||
|
||
Parameters: | ||
|
||
* `<enabled>` - 0 is disabled, 1 is enabled. | ||
* `<lat>` - Latitude (WGS84), in degrees * 1E7 (for example 123456789 means 12.3456789). | ||
* `<lon>` - Longitude. | ||
|
||
Safehomes are saved along with your regular settings and will appear in `diff` and `dump` output. Use `save` to save any changes, as with other settings. | ||
|
||
### `safehome` example | ||
|
||
``` | ||
# safehome | ||
safehome 0 1 543533193 -45179273 | ||
safehome 1 1 435464846 -78654544 | ||
safehome 2 0 0 0 | ||
safehome 3 0 0 0 | ||
safehome 4 0 0 0 | ||
safehome 5 0 0 0 | ||
safehome 6 0 0 0 | ||
safehome 7 0 0 0 | ||
``` | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* This file is part of iNav. | ||
* | ||
* iNav is free software. You can redistribute this software | ||
* and/or modify this software under the terms of the | ||
* GNU General Public License as published by the Free Software | ||
* Foundation, either version 3 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* iNav is distributed in the hope that they will be | ||
* useful, but WITHOUT ANY WARRANTY; without even the implied | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this software. | ||
* | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdbool.h> | ||
|
||
// tristate_e represents something that can take a default AUTO | ||
// value and two explicit ON and OFF values. To ease the transition | ||
// from boolean settings (0 = OFF, 1 = ON), the 1 value has | ||
// been picked as ON while OFF is represented by 2. AUTO is represented | ||
// by 0. | ||
typedef enum { | ||
TRISTATE_AUTO = 0, | ||
TRISTATE_ON = 1, | ||
TRISTATE_OFF = 2, | ||
} tristate_e; | ||
|
||
// tristateWithDefaultOnIsActive returns false is tristate is TRISTATE_OFF | ||
// and true otherwise. | ||
static inline bool tristateWithDefaultOnIsActive(tristate_e tristate) | ||
{ | ||
return tristate != TRISTATE_OFF; | ||
} | ||
|
||
// tristateWithDefaultOffIsActive returns true is tristate is TRISTATE_ON | ||
// and false otherwise. | ||
static inline bool tristateWithDefaultOffIsActive(tristate_e tristate) | ||
{ | ||
return tristate == TRISTATE_ON; | ||
} | ||
|
||
// tristateWithDefaultIsActive() calls tristateWithDefaultOnIsActive() when | ||
// def is true, and tristateWithDefaultOffIsActive() otherwise. | ||
// See tristateWithDefaultOnIsActive() and tristateWithDefaultOffIsActive() | ||
static inline bool tristateWithDefaultIsActive(tristate_e tristate, bool def) | ||
{ | ||
return def ? tristateWithDefaultOnIsActive(tristate) : tristateWithDefaultOffIsActive(tristate); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.