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

The flight controller of a toy quadrotor in angle mode: it turns the sticks of an RCCommand into rotor speeds. More...

#include <quadrotor_flight_controller.h>

Classes

struct  Parameters

Public Member Functions

 QuadrotorFlightController (const dynamics::QuadrotorDynamicsConfig &config)
 QuadrotorFlightController (const dynamics::QuadrotorDynamicsConfig &config, const Parameters &parameters)
RealVec rotor_speeds (const RCCommand &command, const dynamics::QuadrotorDynamics &quadrotor) const
 The rotor speeds [rad/s] for the command and the state of the quadrotor.
real_t hover_throttle () const noexcept
 The throttle whose thrust carries the weight: 1 / thrust_to_weight.
real_t max_rotor_speed () const noexcept
 The fastest the rotors spin [rad/s], at full throttle.
const Parameters & parameters () const noexcept

Detailed Description

The flight controller of a toy quadrotor in angle mode: it turns the sticks of an RCCommand into rotor speeds.

  • The throttle sets the thrust directly, as a share of the most the rotors can give; there is no height hold, so the pilot holds the height. At hover_throttle() the thrust carries the weight.
  • The roll and pitch sticks set the angles to tilt to, up to max_tilt; letting go levels the quadrotor. A PD controller on each angle, with the body rates for the D part, gives the torque \(\tau = J (\omega_n^2 (\phi_{sp} - \phi) - 2 \zeta \omega_n p)\).
  • The yaw stick sets the rate of turn, up to max_yaw_rate; a P controller on the rate gives the yaw torque.
  • quadrotor_mixer() turns the thrust and the torques into rotor speeds. Disarmed, the rotors stop.

It reads the attitude and the rates of the quadrotor directly; a real flight controller would estimate them from its IMU.

Constructor & Destructor Documentation

◆ QuadrotorFlightController() [1/2]

bitsim::control::QuadrotorFlightController::QuadrotorFlightController ( const dynamics::QuadrotorDynamicsConfig & config)
explicit

◆ QuadrotorFlightController() [2/2]

bitsim::control::QuadrotorFlightController::QuadrotorFlightController ( const dynamics::QuadrotorDynamicsConfig & config,
const Parameters & parameters )

Member Function Documentation

◆ hover_throttle()

real_t bitsim::control::QuadrotorFlightController::hover_throttle ( ) const
inlinenoexcept

The throttle whose thrust carries the weight: 1 / thrust_to_weight.

◆ max_rotor_speed()

real_t bitsim::control::QuadrotorFlightController::max_rotor_speed ( ) const
inlinenoexcept

The fastest the rotors spin [rad/s], at full throttle.

◆ parameters()

const Parameters & bitsim::control::QuadrotorFlightController::parameters ( ) const
inlinenoexcept

◆ rotor_speeds()

RealVec bitsim::control::QuadrotorFlightController::rotor_speeds ( const RCCommand & command,
const dynamics::QuadrotorDynamics & quadrotor ) const

The rotor speeds [rad/s] for the command and the state of the quadrotor.


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