1 #ifndef CONTROLS_ALLOCATOR_SOLVER_THRUST_ALLOCATION_3DOF_QP_SOLVER_H
2 #define CONTROLS_ALLOCATOR_SOLVER_THRUST_ALLOCATION_3DOF_QP_SOLVER_H
6 #include <eigen-quadprog/QuadProg.h>
53 Eigen::QuadProgDense
qp;
68 void setBineq(
float min_force,
float max_force);
107 void setQ(
double val, uint8_t axis)
override;
115 void updateLimits(
float min_force,
float max_force)
override;
Eigen::Matrix< double, 6, 1 > Vector6d
Definition: Types.h:29
Quadratic-programming thrust allocator for 3DOF (X, Y, Yaw) surface vehicles.
Definition: ThrustAllocation3DOFQPSolver.h:20
ThrusterLayout layout
Copy of the layout passed to build()
Definition: ThrustAllocation3DOFQPSolver.h:29
int numThrusters
Number of thrusters in the current layout.
Definition: ThrustAllocation3DOFQPSolver.h:23
Vector6d getBodyForce(const VectorXd &thrusterForces) override
Reconstructs the achieved 6DOF body force from per-thruster forces.
Definition: ThrustAllocation3DOFQPSolver.cpp:107
Eigen::QuadProgDense qp
Dense QP solver instance.
Definition: ThrustAllocation3DOFQPSolver.h:53
VectorXd allocate(const Vector6d &tau) override
Solves the 3DOF QP and returns per-thruster force magnitudes.
Definition: ThrustAllocation3DOFQPSolver.cpp:84
MatrixXd Aeq
3x(N+3) equality-constraint matrix [T_xy_yaw | I_3]
Definition: ThrustAllocation3DOFQPSolver.h:38
void build(const ThrusterLayout &layout) override
Builds QP matrices and initialises the solver from a thruster layout.
Definition: ThrustAllocation3DOFQPSolver.cpp:8
MatrixXd Q
(N+3)x(N+3) quadratic cost matrix (thruster effort + slack penalties)
Definition: ThrustAllocation3DOFQPSolver.h:50
void updateLimits(float min_force, float max_force) override
Updates the per-thruster force bounds for the QP inequality constraints.
Definition: ThrustAllocation3DOFQPSolver.cpp:119
MatrixXd T_full
Full 6xN allocation matrix retained for getBodyForce()
Definition: ThrustAllocation3DOFQPSolver.h:35
ThrustAllocation3DOFQPSolver()=default
void buildQPMatrices(const MatrixXd &T_full)
Builds the equality and inequality QP matrices from the allocation matrix.
Definition: ThrustAllocation3DOFQPSolver.cpp:51
VectorXd C
Linear cost vector (zero for pure quadratic minimisation)
Definition: ThrustAllocation3DOFQPSolver.h:47
std::vector< Thruster > sorted_thrusters
Thrusters sorted by idx for deterministic column ordering.
Definition: ThrustAllocation3DOFQPSolver.h:32
void setBineq(float min_force, float max_force)
Updates the inequality RHS vector with new per-thruster force bounds.
Definition: ThrustAllocation3DOFQPSolver.cpp:75
std::vector< int > thrustersIdxMapping
Maps QP variable index i to the global thruster idx.
Definition: ThrustAllocation3DOFQPSolver.h:26
VectorXd Bineq
2N-element inequality right-hand side vector
Definition: ThrustAllocation3DOFQPSolver.h:44
MatrixXd Aineq
2Nx(N+3) inequality-constraint matrix encoding per-thruster bounds
Definition: ThrustAllocation3DOFQPSolver.h:41
void setQ(double val, uint8_t axis) override
Sets the slack-variable penalty weight for a 3DOF-relevant axis.
Definition: ThrustAllocation3DOFQPSolver.cpp:123
Abstract interface for quadratic-programming thrust allocation solvers.
Definition: ThrustAllocationSolverInterface.h:15
Manages a collection of Thruster objects and builds the allocation matrix.
Definition: ThrusterLayout.h:11