1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-20 06:45:14 +03:00

Merge pull request #1512 from iNavFlight/fw-coordinated-turn

Fixed wing coordinated turn
This commit is contained in:
Konstantin Sharlaimov 2017-04-14 00:04:52 +10:00 committed by GitHub
commit c5616f55c8
10 changed files with 85 additions and 40 deletions

View file

@ -116,7 +116,6 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
.max_throttle = 1700,
.min_throttle = 1200,
.pitch_to_throttle = 10, // pwm units per degree of pitch (10pwm units ~ 1% throttle)
.roll_to_pitch = 75, // percent of coupling
.loiter_radius = 5000, // 50m
// Fixed wing launch
@ -2424,13 +2423,33 @@ bool naivationRequiresAngleMode(void)
return (currentState & NAV_REQUIRE_ANGLE) || ((currentState & NAV_REQUIRE_ANGLE_FW) && STATE(FIXED_WING));
}
/*-----------------------------------------------------------
* An indicator that TURN ASSISTANCE is required for navigation
*-----------------------------------------------------------*/
bool naivationRequiresTurnAssistance(void)
{
const navigationFSMStateFlags_t currentState = navGetStateFlags(posControl.navState);
if (STATE(FIXED_WING)) {
// For airplanes turn assistant is always required when controlling position
return (currentState & NAV_CTL_POS);
}
else {
return false;
}
}
/**
* An indicator that NAV is in charge of heading control (a signal to disable other heading controllers)
*/
int8_t naivationGetHeadingControlState(void)
{
// No explicit MAG_HOLD mode for airplanes
if ((navGetStateFlags(posControl.navState) & NAV_REQUIRE_MAGHOLD) && !STATE(FIXED_WING)) {
// For airplanes report as manual heading control
if (STATE(FIXED_WING)) {
return NAV_HEADING_CONTROL_MANUAL;
}
// For multirotors it depends on navigation system mode
if (navGetStateFlags(posControl.navState) & NAV_REQUIRE_MAGHOLD) {
if (posControl.flags.isAdjustingHeading) {
return NAV_HEADING_CONTROL_MANUAL;
}