mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-17 05:15:23 +03:00
Add logic condition for 3D home distance based on Pythagorean theorem.
This commit is contained in:
parent
4359590f14
commit
d17bfc67e3
3 changed files with 6 additions and 0 deletions
|
@ -116,6 +116,7 @@ IPF can be edited using INAV Configurator user interface, of via CLI
|
||||||
| 28 | STABILIZED_YAW | Yaw PID controller output `[-500:500]` |
|
| 28 | STABILIZED_YAW | Yaw PID controller output `[-500:500]` |
|
||||||
| 29 | ACTIVE_WAYPOINT_INDEX | Indexed from `1`. To verify WP is in progress, use `IS_WP` |
|
| 29 | ACTIVE_WAYPOINT_INDEX | Indexed from `1`. To verify WP is in progress, use `IS_WP` |
|
||||||
| 30 | ACTIVE_WAYPOINT_ACTION | See ACTIVE_WAYPOINT_ACTION paragraph |
|
| 30 | ACTIVE_WAYPOINT_ACTION | See ACTIVE_WAYPOINT_ACTION paragraph |
|
||||||
|
| 31 | 3D HOME_DISTANCE | in `meters`, calculated from HOME_DISTANCE and ALTITUDE using Pythagorean theorem |
|
||||||
|
|
||||||
##### ACTIVE_WAYPOINT_ACTION
|
##### ACTIVE_WAYPOINT_ACTION
|
||||||
|
|
||||||
|
|
|
@ -478,6 +478,10 @@ static int logicConditionGetFlightOperandValue(int operand) {
|
||||||
return NAV_Status.activeWpAction;
|
return NAV_Status.activeWpAction;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LOGIC_CONDITION_OPERAND_FLIGHT_3D_HOME_DISTANCE: //in m
|
||||||
|
return constrain(sqrtf(sq(GPS_distanceToHome) + sq(getEstimatedActualPosition(Z)/100)), 0, INT16_MAX);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -112,6 +112,7 @@ typedef enum {
|
||||||
LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_YAW, // 28
|
LOGIC_CONDITION_OPERAND_FLIGHT_STABILIZED_YAW, // 28
|
||||||
LOGIC_CONDITION_OPERAND_FLIGHT_WAYPOINT_INDEX, // 29
|
LOGIC_CONDITION_OPERAND_FLIGHT_WAYPOINT_INDEX, // 29
|
||||||
LOGIC_CONDITION_OPERAND_FLIGHT_WAYPOINT_ACTION, // 30
|
LOGIC_CONDITION_OPERAND_FLIGHT_WAYPOINT_ACTION, // 30
|
||||||
|
LOGIC_CONDITION_OPERAND_FLIGHT_3D_HOME_DISTANCE, // 31
|
||||||
} logicFlightOperands_e;
|
} logicFlightOperands_e;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue