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

Implementation of various control algorithms. More...

Classes

struct  bitsim::control::DiffDriveCommand
 What a differential drive robot is told to do: drive at v [m/s] and turn at omega [rad/s], counterclockwise positive. More...
struct  bitsim::control::RCCommand
 What the sticks of a radio transmitter for a quadrotor say, as a toy drone's transmitter sends them: the throttle and three sticks, and whether the motors are armed. More...
class  bitsim::control::InfraredLineFollower
 Follow a dark line with a row of infrared elements. More...
class  bitsim::control::LinearMPC
 Model predictive control with a linear model, a quadratic cost and bounds on the inputs and the states. More...
class  bitsim::control::LQRController
 A linear state feedback about an operating point, \(u = u_{ref} - K (x - x_{ref})\), with optional bounds on each input. More...
class  bitsim::control::PIController
 A PI controller whose output is limited to [-limit, limit], with anti-windup and a feedforward term. More...
class  bitsim::control::PIDController
 A PID controller, \(u = K_p e + K_i \int e\, dt + K_d \dot e\) with \(e\) = target - current, and optional limits on its output. More...
class  bitsim::control::QuadrotorFlightController
 The flight controller of a toy quadrotor in angle mode: it turns the sticks of an RCCommand into rotor speeds. More...
class  bitsim::maths::optimization::QPSolver
 A solver of the convex quadratic program. More...

Functions

RealVec bitsim::control::quadrotor_mixer (const dynamics::QuadrotorDynamicsConfig &config, real_t thrust, const RealColVec3d &tau, real_t max_rotor_speed)
 The rotor speeds [rad/s] of a plus quadrotor (see dynamics::QuadrotorDynamics) that give the thrust T [N] and the torques tau [N m] about the body's x, y and z axes.
RCCommand bitsim::control::failsafe_command () noexcept
 What a receiver does when it loses the transmitter: disarm, so the motors stop.

Detailed Description

Implementation of various control algorithms.

This module contains implementations of various control algorithms.

Function Documentation

◆ failsafe_command()

RCCommand bitsim::control::failsafe_command ( )
inlinenoexcept

What a receiver does when it loses the transmitter: disarm, so the motors stop.

◆ quadrotor_mixer()

RealVec bitsim::control::quadrotor_mixer ( const dynamics::QuadrotorDynamicsConfig & config,
real_t thrust,
const RealColVec3d & tau,
real_t max_rotor_speed )

The rotor speeds [rad/s] of a plus quadrotor (see dynamics::QuadrotorDynamics) that give the thrust T [N] and the torques tau [N m] about the body's x, y and z axes.

The thrust and torques are linear in the squares of the speeds, \(s_i = \omega_i^2\):

\[s_{1,3} = \frac{T}{4k_1} \pm \frac{\tau_\theta}{2lk_1} + \frac{\tau_\psi}{4k_2}, \qquad s_{2,4} = \frac{T}{4k_1} \mp \frac{\tau_\phi}{2lk_1} - \frac{\tau_\psi}{4k_2} \]

Each \(s_i\) is clamped to \([0, \omega_{max}^2]\): a rotor cannot push down, nor spin faster than its motor allows, and then the torques are not all met.