bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
fixed_wing_lqr_mpc::FixedWingDynamics Class Reference

The 6-DOF flight dynamics of a fixed wing aircraft, with its landing gear on a flat ground at down = 0. More...

#include <fixed_wing_dynamics.h>

Public Member Functions

 FixedWingDynamics (const FixedWingParameters &parameters, const FixedWingState &state)
void step (const FixedWingControls &controls, real_t dt)
 Advance by dt [s] with the given controls, which are first limited.
FixedWingState derivative (const FixedWingState &x, const FixedWingControls &controls) const
FixedWingForces forces (const FixedWingState &x, const FixedWingControls &controls) const
FixedWingControls limit (const FixedWingControls &controls) const
void set_wind (const RealColVec3d &wind_ned)
 The wind, in the world [m/s]; the direction it blows towards.
const RealColVec3d & wind () const noexcept
const FixedWingState & state () const noexcept
FixedWingState & state () noexcept
const FixedWingParameters & parameters () const noexcept
real_t time () const noexcept
real_t airspeed () const
real_t alpha () const
real_t beta () const
real_t altitude () const
real_t ground_speed () const
real_t course () const
 the direction of the velocity over the ground [rad]
real_t climb_rate () const
 [m/s], positive up
bool on_ground () const
 whether a wheel touches the ground

Static Public Member Functions

static RealMat3d rotation (real_t phi, real_t theta, real_t psi)

Detailed Description

The 6-DOF flight dynamics of a fixed wing aircraft, with its landing gear on a flat ground at down = 0.

The world is NED and the body frame has x forward, y right and z down; the body is turned from the world by \(R = R_z(\psi) R_y(\theta) R_x(\phi)\). The model follows Beard and McLain, Small Unmanned Aircraft: Theory and Practice:

  • Air data. The velocity relative to the air is \(v_r = v - R^T w\), with \(w\) the wind in the world, and gives the airspeed \(V_a\), the angle of attack \(\alpha = \arctan(w_r / u_r)\) and the sideslip \(\beta = \arcsin(v_r / V_a)\).
  • Lift and drag come from \(\alpha\), the pitch rate and the elevator. The lift is linear in \(\alpha\) up to the stall, then blends into that of a flat plate; the drag is \(C_{D0}\) plus the induced drag \(C_L^2 / (\pi e A)\).
  • Side force and the moments are linear in \(\beta\), the rates and the controls.
  • The propeller is driven by a DC motor: for the throttle's voltage and the airspeed, the motor speed is where the motor's torque equals the propeller's, and the thrust and torque follow from the advance ratio.
  • Each wheel pushes up with \(k d + c \dot d\) while it is \(d\) below the ground, and rolls and grips with friction proportional to that load.

step() integrates with fourth order Runge-Kutta, in substeps of at most 2 ms for the stiff landing gear.

Constructor & Destructor Documentation

◆ FixedWingDynamics()

Member Function Documentation

◆ airspeed()

◆ alpha()

◆ altitude()

◆ beta()

◆ climb_rate()

◆ course()

the direction of the velocity over the ground [rad]

◆ derivative()

Returns
The derivative of the state, for the state and the controls

◆ forces()

FixedWingForces bitsim::dynamics::FixedWingDynamics::forces ( const FixedWingState & x,
const FixedWingControls & controls ) const
Returns
The forces and moments on the aircraft, in the body frame

◆ ground_speed()

◆ limit()

Returns
The controls limited to what the aircraft can do

◆ on_ground()

whether a wheel touches the ground

◆ parameters()

◆ rotation()

Returns
The rotation from the body frame to the world

◆ set_wind()

The wind, in the world [m/s]; the direction it blows towards.

◆ state() [1/2]

◆ state() [2/2]

◆ step()

Advance by dt [s] with the given controls, which are first limited.

◆ time()

◆ wind()

const RealColVec3d & bitsim::dynamics::FixedWingDynamics::wind ( ) const
inlinenoexcept

The documentation for this class was generated from the following files: