controls  3.0.0
ThrustAllocation3DOFQPSolver.h
Go to the documentation of this file.
1 #ifndef CONTROLS_ALLOCATOR_SOLVER_THRUST_ALLOCATION_3DOF_QP_SOLVER_H
2 #define CONTROLS_ALLOCATOR_SOLVER_THRUST_ALLOCATION_3DOF_QP_SOLVER_H
3 
6 #include <eigen-quadprog/QuadProg.h>
7 
8 #include <vector>
9 
21 protected:
24 
26  MatrixXd T_full_;
27 
29  MatrixXd Aeq_;
30 
32  MatrixXd Aineq_;
33 
35  VectorXd Bineq_;
36 
38  VectorXd C_;
39 
41  MatrixXd Q_;
42 
44  Eigen::QuadProgDense qp_;
45 
51  void build_qp_matrices(const MatrixXd& T_full);
52 
59  void set_bineq(float min_force, float max_force);
60 
61 public:
63 
69  void build(const ThrusterLayout& layout) override;
70 
78  VectorXd allocate(const Vector6d& tau) override;
79 
90  Vector6d get_body_force(const VectorXd& thruster_forces) override;
91 
101  void set_q(double val, uint8_t axis) override;
102 
109  void update_limits(float min_force, float max_force) override;
110 };
111 
112 #endif // CONTROLS_ALLOCATOR_SOLVER_THRUST_ALLOCATION_3DOF_QP_SOLVER_H
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
MatrixXd Aineq_
2Nx(N+3) inequality-constraint matrix encoding per-thruster bounds
Definition: ThrustAllocation3DOFQPSolver.h:32
int num_thrusters_
Number of thrusters in the current layout.
Definition: ThrustAllocation3DOFQPSolver.h:23
VectorXd C_
Linear cost vector (zero for pure quadratic minimisation)
Definition: ThrustAllocation3DOFQPSolver.h:38
void set_bineq(float min_force, float max_force)
Updates the inequality RHS vector with new per-thruster force bounds.
Definition: ThrustAllocation3DOFQPSolver.cpp:54
Vector6d get_body_force(const VectorXd &thruster_forces) override
Reconstructs the achieved 6DOF body force from per-thruster forces.
Definition: ThrustAllocation3DOFQPSolver.cpp:82
VectorXd Bineq_
2N-element inequality right-hand side vector
Definition: ThrustAllocation3DOFQPSolver.h:35
VectorXd allocate(const Vector6d &tau) override
Solves the 3DOF QP and returns per-thruster force magnitudes.
Definition: ThrustAllocation3DOFQPSolver.cpp:63
void build(const ThrusterLayout &layout) override
Builds QP matrices and initialises the solver from a thruster layout.
Definition: ThrustAllocation3DOFQPSolver.cpp:8
MatrixXd Aeq_
3x(N+3) equality-constraint matrix [T_xy_yaw | I_3]
Definition: ThrustAllocation3DOFQPSolver.h:29
void build_qp_matrices(const MatrixXd &T_full)
Builds the equality and inequality QP matrices from the allocation matrix.
Definition: ThrustAllocation3DOFQPSolver.cpp:34
void update_limits(float min_force, float max_force) override
Updates the per-thruster force bounds for the QP inequality constraints.
Definition: ThrustAllocation3DOFQPSolver.cpp:86
Eigen::QuadProgDense qp_
Dense QP solver instance.
Definition: ThrustAllocation3DOFQPSolver.h:44
MatrixXd T_full_
Full 6xN allocation matrix retained for get_body_force()
Definition: ThrustAllocation3DOFQPSolver.h:26
void set_q(double val, uint8_t axis) override
Sets the slack-variable penalty weight for a 3DOF-relevant axis.
Definition: ThrustAllocation3DOFQPSolver.cpp:90
MatrixXd Q_
(N+3)x(N+3) quadratic cost matrix (thruster effort + slack penalties)
Definition: ThrustAllocation3DOFQPSolver.h:41
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