|
controls
3.0.0
|
Quadratic-programming thrust allocator for 3DOF (X, Y, Yaw) surface vehicles. More...
#include <ThrustAllocation3DOFQPSolver.h>
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 | getBodyForce (const VectorXd &thrusterForces) override |
| Reconstructs the achieved 6DOF body force from per-thruster forces. More... | |
| void | setQ (double val, uint8_t axis) override |
| Sets the slack-variable penalty weight for a 3DOF-relevant axis. More... | |
| void | updateLimits (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 | buildQPMatrices (const MatrixXd &T_full) |
| Builds the equality and inequality QP matrices from the allocation matrix. More... | |
| void | setBineq (float min_force, float max_force) |
| Updates the inequality RHS vector with new per-thruster force bounds. More... | |
Protected Attributes | |
| int | numThrusters |
| Number of thrusters in the current layout. More... | |
| std::vector< int > | thrustersIdxMapping |
| Maps QP variable index i to the global thruster idx. More... | |
| ThrusterLayout | layout |
| Copy of the layout passed to build() More... | |
| std::vector< Thruster > | sorted_thrusters |
| Thrusters sorted by idx for deterministic column ordering. More... | |
| MatrixXd | T_full |
| Full 6xN allocation matrix retained for getBodyForce() 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... | |
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.
|
default |
|
overridevirtual |
Solves the 3DOF QP and returns per-thruster force magnitudes.
| tau | [in] Desired 6DOF body force vector (only X, Y, Yaw are used) |
Implements ThrustAllocationSolverInterface.
|
overridevirtual |
Builds QP matrices and initialises the solver from a thruster layout.
| layout | [in] Thruster layout describing positions and force directions |
Implements ThrustAllocationSolverInterface.
|
protected |
Builds the equality and inequality QP matrices from the allocation matrix.
| T_full | [in] Full 6xN allocation matrix |
|
overridevirtual |
Reconstructs the achieved 6DOF body force from per-thruster forces.
| thrusterForces | [in] Nx1 vector of per-thruster forces in Newtons |
Implements ThrustAllocationSolverInterface.
|
protected |
Updates the inequality RHS vector with new per-thruster force bounds.
| min_force | [in] Minimum thruster force in Newtons |
| max_force | [in] Maximum thruster force in Newtons |
|
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.
| val | [in] Exponent for the weight (weight = 10^val) |
| axis | [in] Body axis index: 0=X, 1=Y, 5=Yaw |
Implements ThrustAllocationSolverInterface.
|
overridevirtual |
Updates the per-thruster force bounds for the QP inequality constraints.
| min_force | [in] Minimum thruster force in Newtons |
| max_force | [in] Maximum thruster force in Newtons |
Implements ThrustAllocationSolverInterface.
|
protected |
3x(N+3) equality-constraint matrix [T_xy_yaw | I_3]
|
protected |
2Nx(N+3) inequality-constraint matrix encoding per-thruster bounds
|
protected |
2N-element inequality right-hand side vector
|
protected |
Linear cost vector (zero for pure quadratic minimisation)
|
protected |
Copy of the layout passed to build()
|
protected |
Number of thrusters in the current layout.
|
protected |
(N+3)x(N+3) quadratic cost matrix (thruster effort + slack penalties)
|
protected |
Dense QP solver instance.
|
protected |
Thrusters sorted by idx for deterministic column ordering.
|
protected |
Full 6xN allocation matrix retained for getBodyForce()
|
protected |
Maps QP variable index i to the global thruster idx.