CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

Control.Allocation.minimumNormRightInverse

Right inverse E'*(E*E')^-1 for a full-row-rank effectiveness matrix

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputeffectivenessReal[:, :]
outputallocationReal[size(effectiveness, 2), size(effectiveness, 1)]

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function minimumNormRightInverse
    "Right inverse E'*(E*E')^-1 for a full-row-rank effectiveness matrix"
    input Real effectiveness[:, :];
    output Real allocation[size(effectiveness, 2), size(effectiveness, 1)];
  protected
    Integer wrenchDimension = size(effectiveness, 1);
    Integer actuatorCount = size(effectiveness, 2);
    Real gram[wrenchDimension, wrenchDimension];
    Real gramInverse[wrenchDimension, wrenchDimension];
    Boolean accepted;
  algorithm
    assert(actuatorCount >= wrenchDimension,
      "A right inverse requires at least as many actuators as controlled wrench axes");
    gram := effectiveness * transpose(effectiveness);
    (gramInverse, accepted) := LinearAlgebra.solve(
      gram, identity(wrenchDimension));
    assert(accepted,
      "Actuator geometry must provide independent authority in every controlled wrench axis");
    allocation := transpose(effectiveness) * gramInverse;
  end minimumNormRightInverse;