controls  3.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ThrustAllocation3DOFQPSolver Class Reference

Quadratic-programming thrust allocator for 3DOF (X, Y, Yaw) surface vehicles. More...

#include <ThrustAllocation3DOFQPSolver.h>

Inheritance diagram for ThrustAllocation3DOFQPSolver:
ThrustAllocationSolverInterface

Public Member Functions

 ThrustAllocation3DOFQPSolver ()=default
 
void build (const ThrusterLayout &layout) override
 Builds QP matrices and initialises the solver from a thruster layout. More...
 
VectorXd allocate (const Vector6d &tau) override
 Solves the 3DOF QP and returns per-thruster force magnitudes. More...
 
Vector6d get_body_force (const VectorXd &thruster_forces) override
 Reconstructs the achieved 6DOF body force from per-thruster forces. More...
 
void set_q (double val, uint8_t axis) override
 Sets the slack-variable penalty weight for a 3DOF-relevant axis. More...
 
void update_limits (float min_force, float max_force) override
 Updates the per-thruster force bounds for the QP inequality constraints. More...
 
- Public Member Functions inherited from ThrustAllocationSolverInterface
virtual ~ThrustAllocationSolverInterface ()=default
 

Protected Member Functions

void build_qp_matrices (const MatrixXd &T_full)
 Builds the equality and inequality QP matrices from the allocation matrix. More...
 
void set_bineq (float min_force, float max_force)
 Updates the inequality RHS vector with new per-thruster force bounds. More...
 

Protected Attributes

int num_thrusters_
 Number of thrusters in the current layout. More...
 
MatrixXd T_full_
 Full 6xN allocation matrix retained for get_body_force() More...
 
MatrixXd Aeq_
 3x(N+3) equality-constraint matrix [T_xy_yaw | I_3] More...
 
MatrixXd Aineq_
 2Nx(N+3) inequality-constraint matrix encoding per-thruster bounds More...
 
VectorXd Bineq_
 2N-element inequality right-hand side vector More...
 
VectorXd C_
 Linear cost vector (zero for pure quadratic minimisation) More...
 
MatrixXd Q_
 (N+3)x(N+3) quadratic cost matrix (thruster effort + slack penalties) More...
 
Eigen::QuadProgDense qp_
 Dense QP solver instance. More...
 

Detailed Description

Quadratic-programming thrust allocator for 3DOF (X, Y, Yaw) surface vehicles.

Solves a dense QP with N+3 variables (N thruster forces + 3 slack variables), 3 equality constraints (X, Y, Yaw body force matching), and 2N inequality constraints (per-thruster force bounds). Slack variables allow the solver to find a feasible solution even when the requested force is unachievable.

The Z, Roll, and Pitch axes of tau are ignored during allocation.

Constructor & Destructor Documentation

◆ ThrustAllocation3DOFQPSolver()

ThrustAllocation3DOFQPSolver::ThrustAllocation3DOFQPSolver ( )
default

Member Function Documentation

◆ allocate()

VectorXd ThrustAllocation3DOFQPSolver::allocate ( const Vector6d tau)
overridevirtual

Solves the 3DOF QP and returns per-thruster force magnitudes.

Parameters
tau[in] Desired 6DOF body force vector (only X, Y, Yaw are used)
Returns
Nx1 vector of per-thruster forces in Newtons indexed by thruster idx

Implements ThrustAllocationSolverInterface.

◆ build()

void ThrustAllocation3DOFQPSolver::build ( const ThrusterLayout layout)
overridevirtual

Builds QP matrices and initialises the solver from a thruster layout.

Parameters
layout[in] Thruster layout describing positions and force directions

Implements ThrustAllocationSolverInterface.

◆ build_qp_matrices()

void ThrustAllocation3DOFQPSolver::build_qp_matrices ( const MatrixXd &  T_full)
protected

Builds the equality and inequality QP matrices from the allocation matrix.

Parameters
T_full[in] Full 6xN allocation matrix

◆ get_body_force()

Vector6d ThrustAllocation3DOFQPSolver::get_body_force ( const VectorXd &  thruster_forces)
overridevirtual

Reconstructs the achieved 6DOF body force from per-thruster forces.

Uses the full 6xN allocation matrix, so the Z, Roll, and Pitch components are reported even though they are not constrained during 3DOF allocation.

Parameters
thruster_forces[in] Nx1 vector of per-thruster forces in Newtons
Returns
6-element achieved body force/torque vector in N and Nm

Implements ThrustAllocationSolverInterface.

◆ set_bineq()

void ThrustAllocation3DOFQPSolver::set_bineq ( float  min_force,
float  max_force 
)
protected

Updates the inequality RHS vector with new per-thruster force bounds.

Parameters
min_force[in] Minimum thruster force in Newtons
max_force[in] Maximum thruster force in Newtons

◆ set_q()

void ThrustAllocation3DOFQPSolver::set_q ( double  val,
uint8_t  axis 
)
overridevirtual

Sets the slack-variable penalty weight for a 3DOF-relevant axis.

Only axes 0 (X), 1 (Y), and 5 (Yaw) are mapped to slack variables; other axes are silently ignored.

Parameters
val[in] Exponent for the weight (weight = 10^val)
axis[in] Body axis index: 0=X, 1=Y, 5=Yaw

Implements ThrustAllocationSolverInterface.

◆ update_limits()

void ThrustAllocation3DOFQPSolver::update_limits ( float  min_force,
float  max_force 
)
overridevirtual

Updates the per-thruster force bounds for the QP inequality constraints.

Parameters
min_force[in] Minimum thruster force in Newtons
max_force[in] Maximum thruster force in Newtons

Implements ThrustAllocationSolverInterface.

Member Data Documentation

◆ Aeq_

MatrixXd ThrustAllocation3DOFQPSolver::Aeq_
protected

3x(N+3) equality-constraint matrix [T_xy_yaw | I_3]

◆ Aineq_

MatrixXd ThrustAllocation3DOFQPSolver::Aineq_
protected

2Nx(N+3) inequality-constraint matrix encoding per-thruster bounds

◆ Bineq_

VectorXd ThrustAllocation3DOFQPSolver::Bineq_
protected

2N-element inequality right-hand side vector

◆ C_

VectorXd ThrustAllocation3DOFQPSolver::C_
protected

Linear cost vector (zero for pure quadratic minimisation)

◆ num_thrusters_

int ThrustAllocation3DOFQPSolver::num_thrusters_
protected

Number of thrusters in the current layout.

◆ Q_

MatrixXd ThrustAllocation3DOFQPSolver::Q_
protected

(N+3)x(N+3) quadratic cost matrix (thruster effort + slack penalties)

◆ qp_

Eigen::QuadProgDense ThrustAllocation3DOFQPSolver::qp_
protected

Dense QP solver instance.

◆ T_full_

MatrixXd ThrustAllocation3DOFQPSolver::T_full_
protected

Full 6xN allocation matrix retained for get_body_force()


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