bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
fixed_wing_autopilot.h
Go to the documentation of this file.
1#ifndef BITSIM_CONTROL_FIXED_WING_AUTOPILOT_H
2#define BITSIM_CONTROL_FIXED_WING_AUTOPILOT_H
3
7
8namespace bitsim::control
9{
10
20
34
61
78{
79 public:
82
87 const FixedWingCommands &commands, real_t dt);
88
89 // The loops, for a mission that drives some of them itself
90 real_t roll_hold(real_t phi_c, real_t phi, real_t p) const;
91 real_t course_hold(real_t chi_c, real_t chi, real_t dt);
93 real_t pitch_hold(real_t theta_c, real_t theta, real_t q) const;
97
101 void reset();
102
103 const FixedWingAutopilotGains &gains() const noexcept { return gains_; }
104 const FixedWingAutopilotDesign &design() const noexcept { return design_; }
105 const dynamics::FixedWingTrim &trim() const noexcept { return trim_; }
106
107 enum class AltitudeMode
108 {
112 };
113 AltitudeMode altitude_mode() const noexcept { return altitude_mode_; }
114
115 private:
120 AltitudeMode altitude_mode_{AltitudeMode::HOLD};
121
122 real_t course_integral_{0.0};
123 real_t sideslip_integral_{0.0};
124 real_t altitude_integral_{0.0};
125 real_t throttle_integral_{0.0};
126 real_t airspeed_pitch_integral_{0.0};
127};
128
129} // namespace bitsim::control
130
131#endif // BITSIM_CONTROL_FIXED_WING_AUTOPILOT_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
real_t airspeed_with_pitch(real_t Va_c, real_t Va, real_t dt)
Definition fixed_wing_autopilot.cpp:149
real_t course_hold(real_t chi_c, real_t chi, real_t dt)
Definition fixed_wing_autopilot.cpp:117
AltitudeMode
Definition fixed_wing_autopilot.h:108
@ HOLD
Definition fixed_wing_autopilot.h:109
@ CLIMB
Definition fixed_wing_autopilot.h:110
@ DESCEND
Definition fixed_wing_autopilot.h:111
const dynamics::FixedWingTrim & trim() const noexcept
Definition fixed_wing_autopilot.h:105
real_t sideslip_hold(real_t beta, real_t dt)
Definition fixed_wing_autopilot.cpp:124
real_t airspeed_with_throttle(real_t Va_c, real_t Va, real_t dt)
Definition fixed_wing_autopilot.cpp:143
real_t altitude_hold(real_t h_c, real_t h, real_t dt)
Definition fixed_wing_autopilot.cpp:137
const FixedWingAutopilotDesign & design() const noexcept
Definition fixed_wing_autopilot.h:104
dynamics::FixedWingControls update(const dynamics::FixedWingDynamics &aircraft, const FixedWingCommands &commands, real_t dt)
The controls for the commands, after dt [s].
Definition fixed_wing_autopilot.cpp:155
const FixedWingAutopilotGains & gains() const noexcept
Definition fixed_wing_autopilot.h:103
void reset()
Forget the integrators.
Definition fixed_wing_autopilot.cpp:101
FixedWingAutopilot(const dynamics::FixedWingParameters &parameters, const FixedWingAutopilotDesign &design={})
Definition fixed_wing_autopilot.cpp:33
AltitudeMode altitude_mode() const noexcept
Definition fixed_wing_autopilot.h:113
real_t roll_hold(real_t phi_c, real_t phi, real_t p) const
Definition fixed_wing_autopilot.cpp:111
real_t pitch_hold(real_t theta_c, real_t theta, real_t q) const
Definition fixed_wing_autopilot.cpp:130
The 6-DOF flight dynamics of a fixed wing aircraft, with its landing gear on a flat ground at down = ...
Definition fixed_wing_dynamics.h:176
The trim of a fixed wing aircraft for level flight, its linear model about a trim,...
Controllers: PID controllers, line following, a quadrotor flight controller, a fixed wing autopilot,...
Definition control_module.h:18
double real_t
real_t
Definition bitsim_types.h:20
How the loops are designed, and the limits of what they command.
Definition fixed_wing_autopilot.h:39
real_t airspeed_pitch_damping
Definition fixed_wing_autopilot.h:54
real_t airspeed_pitch_separation
Definition fixed_wing_autopilot.h:53
real_t course_separation
how much slower the course loop is than the roll loop
Definition fixed_wing_autopilot.h:43
real_t airspeed_frequency
of the throttle loop [rad/s]
Definition fixed_wing_autopilot.h:51
real_t airspeed_damping
Definition fixed_wing_autopilot.h:52
real_t sideslip_error_max
Definition fixed_wing_autopilot.h:45
real_t roll_damping
Definition fixed_wing_autopilot.h:42
real_t max_bank
[rad]
Definition fixed_wing_autopilot.h:56
real_t max_pitch
[rad]
Definition fixed_wing_autopilot.h:57
real_t altitude_separation
Definition fixed_wing_autopilot.h:49
real_t altitude_band
hold the altitude within it; climb or descend outside [m]
Definition fixed_wing_autopilot.h:59
real_t pitch_error_max
Definition fixed_wing_autopilot.h:47
real_t course_damping
Definition fixed_wing_autopilot.h:44
real_t pitch_damping
Definition fixed_wing_autopilot.h:48
real_t min_pitch
[rad]
Definition fixed_wing_autopilot.h:58
real_t roll_error_max
the roll error at which the aileron reaches its limit [rad]
Definition fixed_wing_autopilot.h:41
real_t sideslip_damping
Definition fixed_wing_autopilot.h:46
real_t altitude_damping
Definition fixed_wing_autopilot.h:50
real_t airspeed
the trim the gains are designed at [m/s]
Definition fixed_wing_autopilot.h:40
The gains of the loops, worked out from the linearised aircraft.
Definition fixed_wing_autopilot.h:25
real_t airspeed_pitch_kp
Definition fixed_wing_autopilot.h:32
real_t course_ki
Definition fixed_wing_autopilot.h:27
real_t pitch_dc_gain
Definition fixed_wing_autopilot.h:29
real_t throttle_ki
Definition fixed_wing_autopilot.h:31
real_t airspeed_pitch_ki
Definition fixed_wing_autopilot.h:32
real_t roll_kd
Definition fixed_wing_autopilot.h:26
real_t sideslip_ki
Definition fixed_wing_autopilot.h:28
real_t altitude_kp
Definition fixed_wing_autopilot.h:30
real_t pitch_kd
Definition fixed_wing_autopilot.h:29
real_t throttle_kp
Definition fixed_wing_autopilot.h:31
real_t roll_kp
Definition fixed_wing_autopilot.h:26
real_t sideslip_kp
Definition fixed_wing_autopilot.h:28
real_t course_kp
Definition fixed_wing_autopilot.h:27
real_t pitch_kp
Definition fixed_wing_autopilot.h:29
real_t altitude_ki
Definition fixed_wing_autopilot.h:30
What the autopilot holds.
Definition fixed_wing_autopilot.h:15
real_t airspeed
[m/s]
Definition fixed_wing_autopilot.h:16
real_t course
the direction over the ground [rad]
Definition fixed_wing_autopilot.h:18
real_t altitude
[m]
Definition fixed_wing_autopilot.h:17
What the pilot or the autopilot sets.
Definition fixed_wing_dynamics.h:47
The aircraft: its mass, its geometry, its aerodynamic coefficients, its propeller and motor,...
Definition fixed_wing_dynamics.h:73
A steady flight: the state and the controls that keep it.
Definition fixed_wing_trim.h:26