Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fied wing updates #304

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
10,571 changes: 6,093 additions & 4,478 deletions obj/baseflight.hex

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,19 @@ const clivalue_t valueTable[] = {
{ "p_vel", VAR_UINT8, &cfg.P8[PIDVEL], 0, 200 },
{ "i_vel", VAR_UINT8, &cfg.I8[PIDVEL], 0, 200 },
{ "d_vel", VAR_UINT8, &cfg.D8[PIDVEL], 0, 200 },
{ "fw_vector_trust", VAR_UINT8, &cfg.fw_vector_trust, 0, 1},
{ "fw_gps_maxcorr", VAR_INT16, &cfg.fw_gps_maxcorr, -45, 45 },
{ "fw_gps_rudder", VAR_INT16, &cfg.fw_gps_rudder, -45, 45 },
{ "fw_gps_maxclimb", VAR_INT16, &cfg.fw_gps_maxclimb, -45, 45 },
{ "fw_gps_maxdive", VAR_INT16, &cfg.fw_gps_maxdive, -45, 45 },
{ "fw_glide_angle", VAR_UINT8, &cfg.fw_glide_angle, 0, 100 },
{ "fw_climb_throttle", VAR_UINT16, &cfg.fw_climb_throttle, 1000, 2000 },
{ "fw_cruise_throttle", VAR_UINT16, &cfg.fw_cruise_throttle, 1000, 2000 },
{ "fw_idle_throttle", VAR_UINT16, &cfg.fw_idle_throttle, 1000, 2000 },
{ "fw_scaler_throttle", VAR_UINT16, &cfg.fw_scaler_throttle, 0, 15 },
{ "fw_roll_comp", VAR_FLOAT, &cfg.fw_roll_comp, 0, 2 },
{ "fw_rth_alt", VAR_UINT8, &cfg.fw_rth_alt, 0, 200 },
{ "fw_roll_comp", VAR_UINT8, &cfg.fw_roll_comp, 0, 250 },
{ "fw_rth_alt", VAR_UINT8, &cfg.fw_rth_alt, 0, 250 },
{ "fw_cruise_distance", VAR_UINT16, &cfg.fw_cruise_distance, 0, 2000},
};

#define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t))
Expand Down Expand Up @@ -1042,12 +1045,11 @@ static void cliMixer(char *cmdline)
// Presets for planes. Not functional with current reset
// Really Ugly Hack
if (mcfg.mixerConfiguration == MULTITYPE_FLYING_WING || mcfg.mixerConfiguration == MULTITYPE_AIRPLANE) {
cfg.dynThrPID = 50;
cfg.dynThrPID = 90;
cfg.rcExpo8 = 0;
cfg.P8[PIDALT] = 30;
cfg.I8[PIDALT] = 20;
cfg.D8[PIDALT] = 45;
cfg.D8[PIDPOSR] = 50; // RTH Alt
cfg.P8[PIDNAVR] = 30;
cfg.I8[PIDNAVR] = 20;
cfg.D8[PIDNAVR] = 45;
Expand Down
6 changes: 4 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ master_t mcfg; // master config struct with data independent from profiles
config_t cfg; // profile config struct
const char rcChannelLetters[] = "AERT1234";

static const uint8_t EEPROM_CONF_VERSION = 75;
static const uint8_t EEPROM_CONF_VERSION = 76;
static uint32_t enabledSensors = 0;
static void resetConf(void);
static const uint32_t FLASH_WRITE_ADDR = 0x08000000 + (FLASH_PAGE_SIZE * (FLASH_PAGE_COUNT - (CONFIG_SIZE / 1024)));
Expand Down Expand Up @@ -353,7 +353,9 @@ static void resetConf(void)
cfg.fw_cruise_throttle = 1500;
cfg.fw_idle_throttle = 1300;
cfg.fw_scaler_throttle = 8;
cfg.fw_roll_comp = 1;
cfg.fw_roll_comp = 100;
cfg.fw_cruise_distance = 500;
cfg.fw_rth_alt = 50;
// control stuff
mcfg.reboot_character = 'R';

Expand Down
27 changes: 22 additions & 5 deletions src/fw_nav.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
// from gps.c
extern int32_t nav_bearing;
extern int32_t wp_distance;
extern int32_t GPS_WP[2];
extern float GPS_scaleLonDown;

extern PID_PARAM navPID_PARAM;
extern PID_PARAM altPID_PARAM;

#define GPS_UPD_HZ 5 // Set loop time for NavUpdate 5 Hz is enough
#define PITCH_COMP 0.5f // Compensate throttle relative angle of attack
// Candidates for CLI
#define SAFE_NAV_ALT 20 // Safe Altitude during climbouts Wings Level below this Alt. (ex. trees & buildings..)
#define SAFE_NAV_ALT 25 // Safe Altitude during climbouts Wings Level below this Alt. (ex. trees & buildings..)
#define SAFE_DECSCEND_ZONE 50 // Radius around home where descending is OK
// For speedBoost
#define GPS_MINSPEED 500 // 500= ~18km/h
Expand Down Expand Up @@ -40,6 +43,19 @@ void fw_nav_reset(void)
}
}

void fw_FlyTo(void) // PatrikE CruiseMode version
{
#define GEO_SKALEFACT 89.832f // Scale to match meters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#defines do not belong inside functions.
move it outside.

int32_t holdHeading = GPS_ground_course / 10;
if (holdHeading > 180)
holdHeading -= 360;
float scaler = ( GEO_SKALEFACT / GPS_scaleLonDown) * cfg.fw_cruise_distance;
float wp_lat_diff = cos(holdHeading * 0.0174532925f);
float wp_lon_diff = sin(holdHeading * 0.0174532925f) * GPS_scaleLonDown;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variables must be declared at start of scope, not in the middle.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces from the float wp_lon_diff = line (you will do it anyway when you move the variables to top of scope)

GPS_WP[LAT] += wp_lat_diff * scaler;
GPS_WP[LON] += wp_lon_diff * scaler;
}

void fw_nav(void)
{
int16_t GPS_Heading = GPS_ground_course; // Store current bearing
Expand Down Expand Up @@ -130,7 +146,6 @@ void fw_nav(void)
if (abs(navDiff) > 170)
navDiff = 175; // Forced turn.


// PID for Navigating planes.
navDT = (float) (millis() - nav_loopT) / 1000;
nav_loopT = millis();
Expand Down Expand Up @@ -201,16 +216,15 @@ void fw_nav(void)
// Elevator compensation depending on behaviour.
// Prevent stall with Disarmed motor
if (f.MOTORS_STOPPED)
GPS_angle[PITCH] = constrain(GPS_angle[PITCH], 0, cfg.fw_gps_maxdive * 10);
GPS_angle[PITCH] = constrain(GPS_angle[PITCH], -cfg.fw_glide_angle, cfg.fw_gps_maxdive * 10);

// Add elevator compared with rollAngle
if (!f.CLIMBOUT_FW)
GPS_angle[PITCH] -= (abs(angle[ROLL]) * cfg.fw_roll_comp);
GPS_angle[PITCH] -= (abs(angle[ROLL]) * (cfg.fw_roll_comp / 100));

// Throttle compensation depending on behaviour.
// Compensate throttle with pitch Angle
NAV_Thro -= constrain(angle[PITCH] * PITCH_COMP, 0, 450);
NAV_Thro = constrain(NAV_Thro, cfg.fw_idle_throttle, cfg.fw_climb_throttle);

// Force the Plane move forward in headwind with speedBoost
groundSpeed = GPS_speed;
Expand All @@ -221,6 +235,9 @@ void fw_nav(void)

speedBoost = constrain(speedBoost, 0, 500);
NAV_Thro += speedBoost;

// constrain throttle to Max climb.
NAV_Thro = constrain(NAV_Thro, cfg.fw_idle_throttle, cfg.fw_climb_throttle);
}
// End of NavTimer

Expand Down
7 changes: 5 additions & 2 deletions src/gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,15 +505,15 @@ static void reset_PID(PID *pid)

static float dTnav; // Delta Time in milliseconds for navigation computations, updated with every good GPS read
static int16_t actual_speed[2] = { 0, 0 };
static float GPS_scaleLonDown = 1.0f; // this is used to offset the shrinking longitude as we go towards the poles
float GPS_scaleLonDown = 1.0f; // this is used to offset the shrinking longitude as we go towards the poles

// The difference between the desired rate of travel and the actual rate of travel
// updated after GPS read - 5-10hz
static int16_t rate_error[2];
static int32_t error[2];

// Currently used WP
static int32_t GPS_WP[2];
int32_t GPS_WP[2];

////////////////////////////////////////////////////////////////////////////////
// Location & Navigation
Expand Down Expand Up @@ -768,6 +768,9 @@ void GPS_set_next_wp(int32_t *lat, int32_t *lon)
GPS_WP[LON] = *lon;

GPS_calc_longitude_scaling(*lat);
if (f.CRUISE_MODE)
fw_FlyTo(); // PatrikE CruiseMode version

GPS_distance_cm_bearing(&GPS_coord[LAT], &GPS_coord[LON], &GPS_WP[LAT], &GPS_WP[LON], &wp_distance, &target_bearing);

nav_bearing = target_bearing;
Expand Down
29 changes: 22 additions & 7 deletions src/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const mixer_t mixers[] = {
{ 8, 0, mixerOctoX8 }, // MULTITYPE_OCTOX8
{ 8, 0, mixerOctoFlatP }, // MULTITYPE_OCTOFLATP
{ 8, 0, mixerOctoFlatX }, // MULTITYPE_OCTOFLATX
{ 1, 1, NULL }, // * MULTITYPE_AIRPLANE
{ 2, 1, mixerTrustVector }, // * MULTITYPE_AIRPLANE
{ 0, 1, NULL }, // * MULTITYPE_HELI_120_CCPM
{ 0, 1, NULL }, // * MULTITYPE_HELI_90_DEG
{ 4, 0, mixerVtail4 }, // MULTITYPE_VTAIL4
Expand All @@ -166,7 +166,7 @@ const mixer_t mixers[] = {
{ 1, 1, NULL }, // MULTITYPE_SINGLECOPTER
{ 4, 0, mixerAtail4 }, // MULTITYPE_ATAIL4
{ 0, 0, NULL }, // MULTITYPE_CUSTOM
{ 1, 1, NULL }, // MULTITYPE_CUSTOM_PLANE
{ 2, 1, mixerTrustVector }, // MULTITYPE_CUSTOM_PLANE
};

// mixer rule format servo, input, rate, speed, min, max, box
Expand Down Expand Up @@ -549,13 +549,27 @@ void mixTable(void)
for (i = 0; i < numberMotor; i++)
motor[i] = rcCommand[THROTTLE] * currentMixer[i].throttle + axisPID[PITCH] * currentMixer[i].pitch + axisPID[ROLL] * currentMixer[i].roll + -cfg.yaw_direction * axisPID[YAW] * currentMixer[i].yaw;

if (f.FIXED_WING) {
if (!f.ARMED)
motor[0] = mcfg.mincommand; // Kill throttle when disarmed
else
motor[0] = constrain(rcCommand[THROTTLE], mcfg.minthrottle, mcfg.maxthrottle);
if (f.FIXED_WING) { // vector_trust handeling
if (cfg.fw_vector_trust && f.ARMED) {
if (f.PASSTHRU_MODE) {
motor[0] = rcCommand[THROTTLE] - rcCommand[YAW] * 0.5f;
motor[1] = rcCommand[THROTTLE] + rcCommand[YAW] * 0.5f;
} else {
motor[0] = rcCommand[THROTTLE] - axisPID[YAW] * 0.5f;
motor[1] = rcCommand[THROTTLE] + axisPID[YAW] * 0.5f;
}
}
if (!cfg.fw_vector_trust) {
motor[0] = rcCommand[THROTTLE];
motor[1] = rcCommand[THROTTLE];
}
if (!f.ARMED || ((rcData[THROTTLE]) < mcfg.mincheck && feature(FEATURE_MOTOR_STOP))) {
motor[0] = mcfg.mincommand;
motor[1] = mcfg.mincommand;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There has to be a better way to write the above, I don't understand what current version does so surely there's a simpler way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I'm actually not understanding why this is necessary?
also, is it vector TRUST or vector THRUST?
So if I understand this new code, the following happens:

  1. for each motor, it writes motor[] = rcCommand[THROTTLE] * currentMixer[i].throttle + axisPID[PITCH] * currentMixer[i].pitch + axisPID[ROLL] * currentMixer[i].roll + -cfg.yaw_direction * axisPID[YAW] * currentMixer[i].yaw;
  2. if it's in fixed wing mode, it replaces motor[] with either rccommand[throttle] or
  3. If it's in fixed wing + "vector trust??", then it replaces with throttle + yaw formula.

Is this correct?

  1. for each motor, it writes motor[] =

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's vector THRUST.
The function is.
For Fixed Wing vector THRUST is normally active.
Yaw mixed to motors for "Rudder" function.
In Passthru The axisPids is overwritten by Yaw from RC only.

if cfg.fw_vector_trust = false
Pure Throttle command will be forced to motor[i]

The for loop is used to write motor[i] =



// airplane / servo mixes
switch (mcfg.mixerConfiguration) {
case MULTITYPE_CUSTOM_PLANE:
Expand Down Expand Up @@ -639,6 +653,7 @@ void mixTable(void)
}
if (!f.ARMED) {
motor[i] = motor_disarmed[i];
f.MOTORS_STOPPED = 1;
}
}
}
46 changes: 38 additions & 8 deletions src/mw.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,39 @@ void annexCode(void)
static int64_t mAhdrawnRaw = 0;
static int32_t vbatCycleTime = 0;

// PITCH & ROLL only dynamic PID adjustemnt, depending on throttle value
if (rcData[THROTTLE] < cfg.tpa_breakpoint) {
prop2 = 100;
} else {
if (rcData[THROTTLE] < 2000) {
prop2 = 100 - (uint16_t)cfg.dynThrPID * (rcData[THROTTLE] - cfg.tpa_breakpoint) / (2000 - cfg.tpa_breakpoint);
if (!f.FIXED_WING) { // Baseflight original dynamic PID adjustemnt
// PITCH & ROLL only dynamic PID adjustemnt, depending on throttle value
if (rcData[THROTTLE] < cfg.tpa_breakpoint) {
prop2 = 100;
} else {
prop2 = 100 - cfg.dynThrPID;
if (rcData[THROTTLE] < 2000) {
prop2 = 100 - (uint16_t)cfg.dynThrPID * (rcData[THROTTLE] - cfg.tpa_breakpoint) / (2000 - cfg.tpa_breakpoint);
} else {
prop2 = 100 - cfg.dynThrPID;
}
}
} else { // Throttle & Angle combined PID adjustemnt
// PITCH & ROLL only dynamic PID adjustemnt, depending on throttle value
prop2 = 128; // prop2 was 100, is 128 now
if (rcData[THROTTLE] < cfg.tpa_breakpoint) {
prop2 = 128;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing space here

} else {
if (rcCommand[THROTTLE] > cfg.dynThrPID) {
if (rcCommand[THROTTLE] < 2000) {
prop2 -= ((uint16_t)cfg.dynThrPID * (rcCommand[THROTTLE] - cfg.dynThrPID) >> 9); // /512 instead of /500
} else {
prop2 -= cfg.dynThrPID;
}
}
}
// APA dynamic PID adjustemnt, depending on Angle of attack
uint16_t MaxBrkpoint = 300; // Max angle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this variable is not at start of scope

if (angle[1] > 20)
prop2 -= ((uint16_t)cfg.dynThrPID * (min(angle[1], MaxBrkpoint)) >> 8);
prop2 = max((128 - cfg.dynThrPID), prop2);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's copypasted code here and its function is unclear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding Dive angle to TPA for Fixed wing.
Higher values for planes as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but this code duplicates already stupid code.

what does it acutally do and can it be rewritten better?
On Jan 2, 2016 9:03 PM, "EmilsPa" [email protected] wrote:

In src/mw.c
#304 (comment):

  •    if (rcData[THROTTLE] < cfg.tpa_breakpoint) {
    
  •        prop2 = 128;
    
  •    } else {
    
  •        if (rcCommand[THROTTLE] > cfg.dynThrPID) {
    
  •            if (rcCommand[THROTTLE] < 2000) {
    
  •                prop2 -=  ((uint16_t)cfg.dynThrPID \* (rcCommand[THROTTLE] - cfg.dynThrPID) >> 9); //  /512 instead of /500
    
  •            } else {
    
  •                prop2 -=  cfg.dynThrPID;
    
  •            }
    
  •        }
    
  •    }
    
  •    // APA dynamic PID adjustemnt, depending on Angle of attack
    
  •    uint16_t MaxBrkpoint = 300; // Max angle
    
  •    if (angle[1] > 20)
    
  •        prop2 -= ((uint16_t)cfg.dynThrPID \* (min(angle[1], MaxBrkpoint)) >> 8);
    
  •    prop2 = max((128 - cfg.dynThrPID), prop2);
    
    }

Adding Dive angle to TPA for Fixed wing.
Higher values for planes as well


Reply to this email directly or view it on GitHub
https://github.com/multiwii/baseflight/pull/304/files#r48684240.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High speed can cause Wobbling (overcorrection)
Since speed of a copter is tied to throttle
It uses Throttle position to dampen the PID effect.
On planes it will miss High speed dives with low throttle.
That's why i added the Angle.

The function works good and i don't know how to improve it atm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but if that's what it does, then the whole shit can be replaced with
something like throttle * somefloatconstant instead of doing this whole
lookup table shit that was only relevant on 8bit stuff.

On Sun, Jan 3, 2016 at 3:11 AM, EmilsPa [email protected] wrote:

In src/mw.c
#304 (comment):

  •    if (rcData[THROTTLE] < cfg.tpa_breakpoint) {
    
  •        prop2 = 128;
    
  •    } else {
    
  •        if (rcCommand[THROTTLE] > cfg.dynThrPID) {
    
  •            if (rcCommand[THROTTLE] < 2000) {
    
  •                prop2 -=  ((uint16_t)cfg.dynThrPID \* (rcCommand[THROTTLE] - cfg.dynThrPID) >> 9); //  /512 instead of /500
    
  •            } else {
    
  •                prop2 -=  cfg.dynThrPID;
    
  •            }
    
  •        }
    
  •    }
    
  •    // APA dynamic PID adjustemnt, depending on Angle of attack
    
  •    uint16_t MaxBrkpoint = 300; // Max angle
    
  •    if (angle[1] > 20)
    
  •        prop2 -= ((uint16_t)cfg.dynThrPID \* (min(angle[1], MaxBrkpoint)) >> 8);
    
  •    prop2 = max((128 - cfg.dynThrPID), prop2);
    
    }

High speed can cause Wobbling (overcorrection)
Since speed of a copter is tied to throttle
It uses Throttle position to dampen the PID effect.
On planes it will miss High speed dives with low throttle.
That's why i added the Angle.

The function works good and i don't know how to improve it atm.


Reply to this email directly or view it on GitHub
https://github.com/multiwii/baseflight/pull/304/files#r48686306.



for (axis = 0; axis < 3; axis++) {
tmp = min(abs(rcData[axis] - mcfg.midrc), 500);
if (axis != 2) { // ROLL & PITCH
Expand Down Expand Up @@ -691,6 +713,11 @@ void loop(void)
auxState |= (rcData[AUX1 + i] < 1300) << (3 * i) | (1300 < rcData[AUX1 + i] && rcData[AUX1 + i] < 1700) << (3 * i + 1) | (rcData[AUX1 + i] > 1700) << (3 * i + 2);
for (i = 0; i < CHECKBOXITEMS; i++)
rcOptions[i] = (auxState & cfg.activate[i]) > 0;
f.CRUISE_MODE = rcOptions[BOXGCRUISE];
if (f.CRUISE_MODE) {
rcOptions[BOXGPSHOLD] = true;
rcOptions[BOXHORIZON] = true;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will above change somehow affect quads if selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No
The selection will not show up in Configurator

// note: if FAILSAFE is disable, failsafeCnt > 5 * FAILSAVE_DELAY is always false
if ((rcOptions[BOXANGLE] || (failsafeCnt > 5 * cfg.failsafe_delay)) && (sensors(SENSOR_ACC))) {
Expand Down Expand Up @@ -782,6 +809,9 @@ void loop(void)
#ifdef GPS
if (sensors(SENSOR_GPS)) {
if (f.GPS_FIX && GPS_numSat >= 5) {
if (nav_mode != NAV_MODE_NONE && (!f.HORIZON_MODE && !f.ANGLE_MODE))
f.ANGLE_MODE = true; // Force a stable mode in GPS Mode

// if both GPS_HOME & GPS_HOLD are checked => GPS_HOME is the priority
if (rcOptions[BOXGPSHOME] || f.FW_FAILSAFE_RTH_ENABLE ) {
if (!f.GPS_HOME_MODE) {
Expand Down Expand Up @@ -832,7 +862,7 @@ void loop(void)
f.PASSTHRU_MODE = 0;
}

if (mcfg.mixerConfiguration == MULTITYPE_FLYING_WING || mcfg.mixerConfiguration == MULTITYPE_AIRPLANE || mcfg.mixerConfiguration == MULTITYPE_CUSTOM_PLANE) {
if (f.FIXED_WING) {
f.HEADFREE_MODE = 0;
if (feature(FEATURE_FAILSAFE) && failsafeCnt > (6 * cfg.failsafe_delay)) {
f.PASSTHRU_MODE = 0;
Expand Down
10 changes: 8 additions & 2 deletions src/mw.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ enum {
BOXSERVO1,
BOXSERVO2,
BOXSERVO3,
BOXGCRUISE,
CHECKBOXITEMS
};

Expand Down Expand Up @@ -282,15 +283,18 @@ typedef struct config_t {
uint16_t ap_mode; // Temporarily Disables GPS_HOLD_MODE to be able to make it possible to adjust the Hold-position when moving the sticks, creating a deadspan for GPS

// fw-related stuff
uint8_t fw_vector_trust; // Enable Vector trust on Twin Engine models
int16_t fw_gps_maxcorr; // Degrees banking Allowed by GPS.
int16_t fw_gps_rudder; // Maximum Rudder
int16_t fw_gps_rudder; // Maximum input of Rudder Allowed by GPS.
int16_t fw_gps_maxclimb; // Degrees climbing . To much can stall the plane.
int16_t fw_gps_maxdive; // Degrees Diving . To much can overspeed the plane.
uint8_t fw_glide_angle; // Glide angle in power off
uint16_t fw_climb_throttle; // Max allowed throttle in GPS modes.
uint16_t fw_cruise_throttle; // Throttle to set for cruisespeed.
uint16_t fw_idle_throttle; // Lowest throttleValue during Descend
uint16_t fw_scaler_throttle; // Adjust to Match Power/Weight ratio of your model
float fw_roll_comp; // How much Elevator compensates Roll in GPS modes
uint8_t fw_roll_comp; // Adds Elevator Based on Roll Angle
int16_t fw_cruise_distance; // Distance to viritual WP.
uint8_t fw_rth_alt; // Min Altitude to keep during RTH. (Max 200m)

} config_t;
Expand Down Expand Up @@ -424,6 +428,7 @@ typedef struct flags_t {
uint8_t MOTORS_STOPPED;
uint8_t FW_FAILSAFE_RTH_ENABLE;
uint8_t CLIMBOUT_FW;
uint8_t CRUISE_MODE;
} flags_t;

extern int16_t gyroZero[3];
Expand Down Expand Up @@ -603,4 +608,5 @@ void GPS_reset_nav(void);
void GPS_set_next_wp(int32_t *lat, int32_t *lon);
int32_t wrap_18000(int32_t error);
void fw_nav(void);
void fw_FlyTo(void);

Loading