|
bitsim
Model, simulate, estimate and control robots in C++
|
Controllers: PID controllers, line following, a quadrotor flight controller, a fixed wing autopilot, linear quadratic regulators and model predictive control. More...
Classes | |
| struct | FixedWingCommands |
| What the autopilot holds. More... | |
| struct | FixedWingAutopilotGains |
| The gains of the loops, worked out from the linearised aircraft. More... | |
| struct | FixedWingAutopilotDesign |
| How the loops are designed, and the limits of what they command. More... | |
| class | FixedWingAutopilot |
| Holds airspeed, altitude and course with loops closed one inside the other, as in Beard and McLain, chapter 6. More... | |
| struct | Runway |
| A runway on the ground: it starts at its threshold and runs along its heading. More... | |
| struct | MissionWaypoint |
| A point of the route, in the world. More... | |
| struct | FixedWingMissionSettings |
| How the mission flies. More... | |
| struct | Touchdown |
| Where and how the aircraft touched down. More... | |
| class | FixedWingMission |
| Takes off from a runway, flies a route of waypoints and lands back on the runway. More... | |
| struct | DiffDriveCommand |
| What a differential drive robot is told to do: drive at v [m/s] and turn at omega [rad/s], counterclockwise positive. More... | |
| class | InfraredLineFollower |
| Follow a dark line with a row of infrared elements. More... | |
| class | LinearMPC |
| Model predictive control with a linear model, a quadratic cost and bounds on the inputs and the states. More... | |
| struct | DiscreteLinearModel |
| A linear model in discrete time, \(x_{k+1} = A x_k + B u_k\). More... | |
| struct | LQRSolution |
| The gain of a linear quadratic regulator and the cost matrix it comes from: the input \(u = -K x\) minimises the cost \(\sum x^T Q x + u^T R u\), or its integral in continuous time, and the cost from x on is \(x^T P x\). More... | |
| class | LQRController |
| A linear state feedback about an operating point, \(u = u_{ref} - K (x - x_{ref})\), with optional bounds on each input. More... | |
| class | PIController |
| A PI controller whose output is limited to [-limit, limit], with anti-windup and a feedforward term. More... | |
| class | 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 | QuadrotorFlightController |
| The flight controller of a toy quadrotor in angle mode: it turns the sticks of an RCCommand into rotor speeds. More... | |
| struct | 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... | |
Typedefs | |
| using | Matrix = RealMat |
| The matrices of the linear models and the controllers. | |
| using | Vector = RealColVec |
| The vectors of the linear models and the controllers: states, inputs. | |
Enumerations | |
| enum class | MissionPhase { TAKEOFF_ROLL , ROTATE , ENROUTE , APPROACH , FLARE , ROLLOUT , STOPPED } |
Functions | |
| std::string | to_string (MissionPhase phase) |
| DiscreteLinearModel | discretise (const Matrix &A, const Matrix &B, real_t dt) |
| Discretise \(\dot x = A x + B u\) for a step dt, with the input held over the step (zero-order hold): \(A_d = e^{A \Delta t}\) and \(B_d = \int_0^{\Delta t} e^{A s} ds \, B\), both from the exponential of one block matrix. Exact for a linear model. | |
| Matrix | solve_dare (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R) |
| Solve the discrete algebraic Riccati equation. | |
| Matrix | solve_care (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R) |
| Solve the continuous algebraic Riccati equation. | |
| LQRSolution | dlqr (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R) |
| The LQR of \(x_{k+1} = A x_k + B u_k\): \(K = (R + B^T P B)^{-1} B^T P A\) with P from solve_dare(). | |
| LQRSolution | lqr (const Matrix &A, const Matrix &B, const Matrix &Q, const Matrix &R) |
| The LQR of \(\dot x = A x + B u\): \(K = R^{-1} B^T P\) with P from solve_care(). | |
| RealVec | 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 | failsafe_command () noexcept |
| What a receiver does when it loses the transmitter: disarm, so the motors stop. | |
Controllers: PID controllers, line following, a quadrotor flight controller, a fixed wing autopilot, linear quadratic regulators and model predictive control.
| using bitsim::control::Matrix = RealMat |
The matrices of the linear models and the controllers.
| using bitsim::control::Vector = RealColVec |
The vectors of the linear models and the controllers: states, inputs.
|
strong |
| DiscreteLinearModel bitsim::control::discretise | ( | const Matrix & | A, |
| const Matrix & | B, | ||
| real_t | dt ) |
Discretise \(\dot x = A x + B u\) for a step dt, with the input held over the step (zero-order hold): \(A_d = e^{A \Delta t}\) and \(B_d = \int_0^{\Delta t} e^{A s} ds \, B\), both from the exponential of one block matrix. Exact for a linear model.
| LQRSolution bitsim::control::dlqr | ( | const Matrix & | A, |
| const Matrix & | B, | ||
| const Matrix & | Q, | ||
| const Matrix & | R ) |
The LQR of \(x_{k+1} = A x_k + B u_k\): \(K = (R + B^T P B)^{-1} B^T P A\) with P from solve_dare().
| LQRSolution bitsim::control::lqr | ( | const Matrix & | A, |
| const Matrix & | B, | ||
| const Matrix & | Q, | ||
| const Matrix & | R ) |
The LQR of \(\dot x = A x + B u\): \(K = R^{-1} B^T P\) with P from solve_care().
| Matrix bitsim::control::solve_care | ( | const Matrix & | A, |
| const Matrix & | B, | ||
| const Matrix & | Q, | ||
| const Matrix & | R ) |
Solve the continuous algebraic Riccati equation.
\[A^T P + P A - P B R^{-1} B^T P + Q = 0 \]
for its stabilising solution, from the matrix sign function of the Hamiltonian matrix: its stable invariant subspace is spanned by \([I; P]\). The same conditions as solve_dare().
| std::invalid_argument | if the sizes do not match |
| std::runtime_error | if it does not converge, which happens when there is no stabilising solution |
| Matrix bitsim::control::solve_dare | ( | const Matrix & | A, |
| const Matrix & | B, | ||
| const Matrix & | Q, | ||
| const Matrix & | R ) |
Solve the discrete algebraic Riccati equation.
\[P = A^T P A - A^T P B (R + B^T P B)^{-1} B^T P A + Q \]
for its stabilising solution, with the structure-preserving doubling algorithm, which converges quadratically. (A, B) must be stabilisable, (A, Q) detectable, Q symmetric and positive semi-definite and R symmetric and positive definite.
| std::invalid_argument | if the sizes do not match |
| std::runtime_error | if it does not converge, which happens when there is no stabilising solution |
| std::string bitsim::control::to_string | ( | MissionPhase | phase | ) |