mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Added non PID airplane flight control system (AFCS) as special flight mode for airplanes
This commit is contained in:
parent
9eb7d1920b
commit
125cb1f4cc
13 changed files with 163 additions and 3 deletions
|
@ -64,6 +64,9 @@
|
|||
|
||||
#include "pid.h"
|
||||
|
||||
#ifdef USE_AIRPLANE_FCS
|
||||
#include "airplane_fcs.h"
|
||||
#endif
|
||||
typedef enum {
|
||||
LEVEL_MODE_OFF = 0,
|
||||
LEVEL_MODE_R,
|
||||
|
@ -267,6 +270,18 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
|||
.chirp_frequency_start_deci_hz = 2,
|
||||
.chirp_frequency_end_deci_hz = 6000,
|
||||
.chirp_time_seconds = 20,
|
||||
#ifdef USE_AIRPLANE_FCS
|
||||
.afcs_pitch_stick_gain = 100,
|
||||
.afcs_pitch_damping_gain = 20,
|
||||
.afcs_pitch_damping_filter_time = 100,
|
||||
.afcs_pitch_stability_gain = 0,
|
||||
.afcs_roll_stick_gain = 100,
|
||||
.afcs_roll_damping_gain = 25,
|
||||
.afcs_yaw_stick_gain = 100,
|
||||
.afcs_yaw_damping_gain = 500,
|
||||
.afcs_yaw_damping_filter_time = 3000,
|
||||
.afcs_yaw_stability_gain = 0,
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1240,6 +1255,14 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
|||
|
||||
#endif // USE_CHIRP
|
||||
|
||||
#ifdef USE_AIRPLANE_FCS
|
||||
bool isAFCS = isFixedWing() && FLIGHT_MODE(AIRPLANE_FCS_MODE);
|
||||
if (isAFCS) {
|
||||
afcsUpdate(pidProfile, currentTimeUs);
|
||||
return; // The airplanes FCS do not need PID controller
|
||||
}
|
||||
#endif
|
||||
|
||||
// ----------PID controller----------
|
||||
for (int axis = FD_ROLL; axis <= FD_YAW; ++axis) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue