mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-25 23:46:04 +08:00
Extra Fixedwing Tuning Parameters: Now you can tune it all from scratch in a single flight
This commit is contained in:
@@ -58,6 +58,8 @@
|
||||
|
||||
<dl_settings name="alt">
|
||||
<dl_setting MAX="0" MIN="-0.2" STEP="0.01" VAR="v_ctl_altitude_pgain" shortname="alt_pgain" param="V_CTL_ALTITUDE_PGAIN"/>
|
||||
<dl_setting MAX="10" MIN="0.1" STEP="0.1" VAR="v_ctl_altitude_max_climb" shortname="max climb" param="V_CTL_ALTITUDE_MAX_CLIMB"/>
|
||||
<dl_setting MAX="2" MIN="0.0" STEP="0.05" VAR="v_ctl_altitude_pre_climb_correction" shortname="pre climb cor" param="V_CTL_ALTITUDE_PRE_CLIMB_CORRECTION"/>
|
||||
</dl_settings>
|
||||
|
||||
<dl_settings name="auto_throttle">
|
||||
@@ -67,6 +69,9 @@
|
||||
<strip_button name="Dash" value="1"/>
|
||||
</dl_setting>
|
||||
|
||||
<dl_setting MAX="1" MIN="0.0" STEP="0.05" VAR="v_ctl_auto_throttle_min_cruise_throttle" shortname="min cruise thr" module="guidance/guidance_v" param="V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE"/>
|
||||
<dl_setting MAX="1" MIN="0.0" STEP="0.05" VAR="v_ctl_auto_throttle_max_cruise_throttle" shortname="max cruise thr" module="guidance/guidance_v" param="V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE"/>
|
||||
|
||||
|
||||
<dl_setting MAX="0.00" MIN="-0.05" STEP="0.005" VAR="v_ctl_auto_throttle_pgain" shortname="throttle_pgain" param="V_CTL_AUTO_THROTTLE_PGAIN"/>
|
||||
<dl_setting MAX="1" MIN="0.0" STEP="0.05" VAR="v_ctl_auto_throttle_igain" shortname="throttle_igain" param="V_CTL_AUTO_THROTTLE_IGAIN"/>
|
||||
|
||||
@@ -42,6 +42,8 @@ float v_ctl_altitude_setpoint;
|
||||
float v_ctl_altitude_pre_climb;
|
||||
float v_ctl_altitude_pgain;
|
||||
float v_ctl_altitude_error;
|
||||
float v_ctl_altitude_pre_climb_correction;
|
||||
float v_ctl_altitude_max_climb;
|
||||
|
||||
/* inner loop */
|
||||
float v_ctl_climb_setpoint;
|
||||
@@ -51,6 +53,8 @@ uint8_t v_ctl_auto_throttle_submode;
|
||||
/* "auto throttle" inner loop parameters */
|
||||
float v_ctl_auto_throttle_cruise_throttle;
|
||||
float v_ctl_auto_throttle_nominal_cruise_throttle;
|
||||
float v_ctl_auto_throttle_min_cruise_throttle;
|
||||
float v_ctl_auto_throttle_max_cruise_throttle;
|
||||
float v_ctl_auto_throttle_climb_throttle_increment;
|
||||
float v_ctl_auto_throttle_pgain;
|
||||
float v_ctl_auto_throttle_igain;
|
||||
@@ -105,6 +109,11 @@ float v_ctl_auto_groundspeed_sum_err;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef V_CTL_ALTITUDE_PRE_CLIMB_CORRECTION
|
||||
#define V_CTL_ALTITUDE_PRE_CLIMB_CORRECTION 1.0f
|
||||
#endif
|
||||
|
||||
|
||||
void v_ctl_init( void ) {
|
||||
/* mode */
|
||||
v_ctl_mode = V_CTL_MODE_MANUAL;
|
||||
@@ -114,6 +123,8 @@ void v_ctl_init( void ) {
|
||||
v_ctl_altitude_pre_climb = 0.;
|
||||
v_ctl_altitude_pgain = V_CTL_ALTITUDE_PGAIN;
|
||||
v_ctl_altitude_error = 0.;
|
||||
v_ctl_altitude_pre_climb_correction = V_CTL_ALTITUDE_PRE_CLIMB_CORRECTION;
|
||||
v_ctl_altitude_max_climb = V_CTL_ALTITUDE_MAX_CLIMB;
|
||||
|
||||
/* inner loops */
|
||||
v_ctl_climb_setpoint = 0.;
|
||||
@@ -122,6 +133,8 @@ void v_ctl_init( void ) {
|
||||
|
||||
/* "auto throttle" inner loop parameters */
|
||||
v_ctl_auto_throttle_nominal_cruise_throttle = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE;
|
||||
v_ctl_auto_throttle_min_cruise_throttle = V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE;
|
||||
v_ctl_auto_throttle_max_cruise_throttle = V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE;
|
||||
v_ctl_auto_throttle_cruise_throttle = v_ctl_auto_throttle_nominal_cruise_throttle;
|
||||
v_ctl_auto_throttle_climb_throttle_increment =
|
||||
V_CTL_AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT;
|
||||
@@ -195,8 +208,8 @@ void v_ctl_altitude_loop( void ) {
|
||||
|
||||
v_ctl_altitude_error = estimator_z - v_ctl_altitude_setpoint;
|
||||
v_ctl_climb_setpoint = altitude_pgain_boost * v_ctl_altitude_pgain * v_ctl_altitude_error
|
||||
+ v_ctl_altitude_pre_climb;
|
||||
BoundAbs(v_ctl_climb_setpoint, V_CTL_ALTITUDE_MAX_CLIMB);
|
||||
+ v_ctl_altitude_pre_climb * v_ctl_altitude_pre_climb_correction;
|
||||
BoundAbs(v_ctl_climb_setpoint, v_ctl_altitude_max_climb);
|
||||
|
||||
#ifdef AGR_CLIMB
|
||||
if ( v_ctl_climb_mode == V_CTL_CLIMB_MODE_AUTO_THROTTLE) {
|
||||
@@ -336,7 +349,7 @@ inline static void v_ctl_climb_auto_throttle_loop(void) {
|
||||
controlled_throttle = (err_airspeed + v_ctl_auto_airspeed_sum_err * v_ctl_auto_airspeed_igain) * v_ctl_auto_airspeed_pgain;
|
||||
|
||||
// Done, set outputs
|
||||
Bound(controlled_throttle, 0, V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE);
|
||||
Bound(controlled_throttle, 0, v_ctl_auto_throttle_max_cruise_throttle);
|
||||
f_throttle = controlled_throttle;
|
||||
nav_pitch = v_ctl_pitch_of_vz;
|
||||
v_ctl_throttle_setpoint = TRIM_UPPRZ(f_throttle * MAX_PPRZ);
|
||||
|
||||
@@ -47,6 +47,8 @@ extern float v_ctl_altitude_error;
|
||||
extern float v_ctl_altitude_setpoint;
|
||||
extern float v_ctl_altitude_pre_climb;
|
||||
extern float v_ctl_altitude_pgain;
|
||||
extern float v_ctl_altitude_pre_climb_correction;
|
||||
extern float v_ctl_altitude_max_climb;
|
||||
|
||||
/* inner loop */
|
||||
extern float v_ctl_climb_setpoint;
|
||||
@@ -61,6 +63,8 @@ extern uint8_t v_ctl_auto_throttle_submode;
|
||||
|
||||
/* "auto throttle" inner loop parameters */
|
||||
extern float v_ctl_auto_throttle_nominal_cruise_throttle;
|
||||
extern float v_ctl_auto_throttle_min_cruise_throttle;
|
||||
extern float v_ctl_auto_throttle_max_cruise_throttle;
|
||||
extern float v_ctl_auto_throttle_cruise_throttle;
|
||||
extern float v_ctl_auto_throttle_climb_throttle_increment;
|
||||
extern float v_ctl_auto_throttle_pgain;
|
||||
@@ -115,7 +119,7 @@ extern void v_ctl_throttle_slew( void );
|
||||
|
||||
#define guidance_v_SetCruiseThrottle(_v) { \
|
||||
v_ctl_auto_throttle_cruise_throttle = (_v ? _v : v_ctl_auto_throttle_nominal_cruise_throttle); \
|
||||
Bound(v_ctl_auto_throttle_cruise_throttle, V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE, V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE); \
|
||||
Bound(v_ctl_auto_throttle_cruise_throttle, v_ctl_auto_throttle_min_cruise_throttle, v_ctl_auto_throttle_max_cruise_throttle); \
|
||||
}
|
||||
|
||||
#define guidance_v_SetAutoThrottleIgain(_v) { \
|
||||
|
||||
Reference in New Issue
Block a user