mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 00:05:28 +03:00
Renamed variable and added new setting nav_fw_pitch2thr_threshold
This commit is contained in:
parent
9ef10703de
commit
a1c7149414
5 changed files with 18 additions and 11 deletions
|
@ -109,6 +109,7 @@ static const OSD_Entry cmsx_menuFixedWingEntries[] =
|
||||||
OSD_SETTING_ENTRY("PITCH TO THR RATIO", SETTING_NAV_FW_PITCH2THR),
|
OSD_SETTING_ENTRY("PITCH TO THR RATIO", SETTING_NAV_FW_PITCH2THR),
|
||||||
OSD_SETTING_ENTRY("LOITER RADIUS", SETTING_NAV_FW_LOITER_RADIUS),
|
OSD_SETTING_ENTRY("LOITER RADIUS", SETTING_NAV_FW_LOITER_RADIUS),
|
||||||
OSD_SETTING_ENTRY("CONTROL SMOOTHNESS", SETTING_NAV_FW_CONTROL_SMOOTHNESS),
|
OSD_SETTING_ENTRY("CONTROL SMOOTHNESS", SETTING_NAV_FW_CONTROL_SMOOTHNESS),
|
||||||
|
OSD_SETTING_ENTRY("PITCH TO THR THRESHOLD", SETTING_NAV_FW_PITCH2THR_THRESHOLD),
|
||||||
|
|
||||||
OSD_BACK_AND_END_ENTRY,
|
OSD_BACK_AND_END_ENTRY,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2260,6 +2260,12 @@ groups:
|
||||||
field: fw.pitch_to_throttle
|
field: fw.pitch_to_throttle
|
||||||
min: 0
|
min: 0
|
||||||
max: 100
|
max: 100
|
||||||
|
- name: nav_fw_pitch2thr_threshold
|
||||||
|
description: "Threshold from zero pitch before pitch_to_throttle is applied [centidegrees]"
|
||||||
|
default_value: "0"
|
||||||
|
field: fw.pitch_to_throttle_thresh
|
||||||
|
min: 0
|
||||||
|
max: 100
|
||||||
- name: nav_fw_loiter_radius
|
- name: nav_fw_loiter_radius
|
||||||
description: "PosHold radius. 3000 to 7500 is a good value (30-75m) [cm]"
|
description: "PosHold radius. 3000 to 7500 is a good value (30-75m) [cm]"
|
||||||
default_value: "5000"
|
default_value: "5000"
|
||||||
|
|
|
@ -87,7 +87,7 @@ PG_REGISTER_ARRAY(navSafeHome_t, MAX_SAFE_HOMES, safeHomeConfig, PG_SAFE_HOME_CO
|
||||||
PG_REGISTER_ARRAY(navWaypoint_t, NAV_MAX_WAYPOINTS, nonVolatileWaypointList, PG_WAYPOINT_MISSION_STORAGE, 0);
|
PG_REGISTER_ARRAY(navWaypoint_t, NAV_MAX_WAYPOINTS, nonVolatileWaypointList, PG_WAYPOINT_MISSION_STORAGE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 7);
|
PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 8);
|
||||||
|
|
||||||
PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
||||||
.general = {
|
.general = {
|
||||||
|
@ -152,6 +152,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
||||||
.max_throttle = 1700,
|
.max_throttle = 1700,
|
||||||
.min_throttle = 1200,
|
.min_throttle = 1200,
|
||||||
.pitch_to_throttle = 10, // pwm units per degree of pitch (10pwm units ~ 1% throttle)
|
.pitch_to_throttle = 10, // pwm units per degree of pitch (10pwm units ~ 1% throttle)
|
||||||
|
.pitch_to_throttle_thresh = 0, // Threshold from zero pitch before pitch_to_throttle is applied [centidegrees]
|
||||||
.loiter_radius = 5000, // 50m
|
.loiter_radius = 5000, // 50m
|
||||||
|
|
||||||
//Fixed wing landing
|
//Fixed wing landing
|
||||||
|
|
|
@ -222,6 +222,7 @@ typedef struct navConfig_s {
|
||||||
uint16_t min_throttle; // Minimum allowed throttle in auto mode
|
uint16_t min_throttle; // Minimum allowed throttle in auto mode
|
||||||
uint16_t max_throttle; // Maximum allowed throttle in auto mode
|
uint16_t max_throttle; // Maximum allowed throttle in auto mode
|
||||||
uint8_t pitch_to_throttle; // Pitch angle (in deg) to throttle gain (in 1/1000's of throttle) (*10)
|
uint8_t pitch_to_throttle; // Pitch angle (in deg) to throttle gain (in 1/1000's of throttle) (*10)
|
||||||
|
uint8_t pitch_to_throttle_thresh; // Threshold from zero pitch before pitch_to_throttle is applied [centidegrees]
|
||||||
uint16_t loiter_radius; // Loiter radius when executing PH on a fixed wing
|
uint16_t loiter_radius; // Loiter radius when executing PH on a fixed wing
|
||||||
int8_t land_dive_angle;
|
int8_t land_dive_angle;
|
||||||
uint16_t launch_velocity_thresh; // Velocity threshold for swing launch detection
|
uint16_t launch_velocity_thresh; // Velocity threshold for swing launch detection
|
||||||
|
|
|
@ -463,18 +463,16 @@ int16_t applyFixedWingMinSpeedController(timeUs_t currentTimeUs)
|
||||||
|
|
||||||
int16_t fixedWingPitchToThrottleCorrection(int16_t pitch)
|
int16_t fixedWingPitchToThrottleCorrection(int16_t pitch)
|
||||||
{
|
{
|
||||||
const int16_t pitch_to_throttle_deadband = 30;
|
if (pitch > navConfig()->fw.pitch_to_throttle_thresh) {
|
||||||
|
// Positive pitch above threshold
|
||||||
if (pitch > pitch_to_throttle_deadband) {
|
return DECIDEGREES_TO_DEGREES(pitch - navConfig()->fw.pitch_to_throttle_thresh) * navConfig()->fw.pitch_to_throttle;
|
||||||
// Above positive pitch deadband
|
|
||||||
return DECIDEGREES_TO_DEGREES(pitch - pitch_to_throttle_deadband) * navConfig()->fw.pitch_to_throttle;
|
|
||||||
}
|
}
|
||||||
else if (pitch < -pitch_to_throttle_deadband) {
|
else if (pitch < -navConfig()->fw.pitch_to_throttle_thresh) {
|
||||||
// Below negative pitch deadband
|
// Negative pitch below threshold
|
||||||
return DECIDEGREES_TO_DEGREES(pitch + pitch_to_throttle_deadband) * navConfig()->fw.pitch_to_throttle;
|
return DECIDEGREES_TO_DEGREES(pitch + navConfig()->fw.pitch_to_throttle_thresh) * navConfig()->fw.pitch_to_throttle;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Inside deadband
|
// Inside pitch_to_throttle_thresh deadband. Make no throttle correction.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue