mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-19 14:25:16 +03:00
Implement CRUISE MODE for Fixed Wing (#3311)
* Nav cruise mode (2D/3D) * CRUISE FLM on LTM telemetry
This commit is contained in:
parent
ee68dcf56d
commit
46ef27db85
12 changed files with 321 additions and 14 deletions
|
@ -182,6 +182,10 @@ void applyFixedWingAltitudeAndThrottleController(timeUs_t currentTimeUs)
|
|||
*-----------------------------------------------------------*/
|
||||
bool adjustFixedWingHeadingFromRCInput(void)
|
||||
{
|
||||
if (ABS(rcCommand[YAW]) > rcControlsConfig()->pos_hold_deadband) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -218,7 +222,8 @@ static void calculateVirtualPositionTarget_FW(float trackingPeriod)
|
|||
#define TAN_15DEG 0.26795f
|
||||
bool needToCalculateCircularLoiter = isApproachingLastWaypoint()
|
||||
&& (distanceToActualTarget <= (navConfig()->fw.loiter_radius / TAN_15DEG))
|
||||
&& (distanceToActualTarget > 50.0f);
|
||||
&& (distanceToActualTarget > 50.0f)
|
||||
&& !FLIGHT_MODE(NAV_CRUISE_MODE);
|
||||
|
||||
// Calculate virtual position for straight movement
|
||||
if (needToCalculateCircularLoiter) {
|
||||
|
@ -545,6 +550,9 @@ void applyFixedWingNavigationController(navigationFSMStateFlags_t navStateFlags,
|
|||
applyFixedWingPositionController(currentTimeUs);
|
||||
#endif
|
||||
|
||||
if (FLIGHT_MODE(NAV_CRUISE_MODE) && posControl.flags.isAdjustingPosition)
|
||||
rcCommand[ROLL] = applyDeadband(rcCommand[ROLL], rcControlsConfig()->pos_hold_deadband);
|
||||
|
||||
//if (navStateFlags & NAV_CTL_YAW)
|
||||
if ((navStateFlags & NAV_CTL_ALT) || (navStateFlags & NAV_CTL_POS))
|
||||
applyFixedWingPitchRollThrottleController(navStateFlags, currentTimeUs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue