1 #ifndef CONTROLS_ALLOCATOR_THRUST_ALLOCATOR_H
2 #define CONTROLS_ALLOCATOR_THRUST_ALLOCATOR_H
8 #include <yaml-cpp/yaml.h>
10 #include <bb_controls_msgs/msg/thruster_forces.hpp>
11 #include <bb_controls_msgs/msg/thrusters.hpp>
12 #include <geometry_msgs/msg/wrench_stamped.hpp>
25 static constexpr
double QP_WEIGHT_XY = 1.0;
26 static constexpr
double QP_WEIGHT_Z = 2.0;
27 static constexpr
double QP_WEIGHT_ROLL = 8.0;
28 static constexpr
double QP_WEIGHT_PITCH = 8.0;
29 static constexpr
double QP_WEIGHT_YAW = 6.0;
41 ThrustAllocator(std::unique_ptr<ThrusterLookupInterface> thruster_lookup,
42 std::unique_ptr<ThrustAllocationSolverInterface> solver,
const std::string& yaml_config_filename);
54 std::tuple<bb_controls_msgs::msg::Thrusters, bb_controls_msgs::msg::ThrusterForces, Vector6d>
allocate(
55 const Vector6d& force,
float battery_voltage);
69 std::unique_ptr<ThrusterLookupInterface> thruster_lookup_;
70 std::unique_ptr<ThrustAllocationSolverInterface> solver_;
72 Vector3d cg_offset_{};
73 bool cg_offset_changed_{
false};
82 void load_configuration(
const std::string& yaml_config_filename);
87 void init_allocator();
Eigen::Matrix< double, 6, 1 > Vector6d
Definition: Types.h:29
Converts a 6DOF body force vector to per-thruster PWM commands.
Definition: ThrustAllocator.h:23
void update_cg_offset(const Vector3d &updated_cg_offset)
Updates the centre-of-gravity offset applied to all thruster positions.
Definition: ThrustAllocator.cpp:117
ThrustAllocator(std::unique_ptr< ThrusterLookupInterface > thruster_lookup, std::unique_ptr< ThrustAllocationSolverInterface > solver, const std::string &yaml_config_filename)
Constructs the allocator, loads YAML config, and initialises the QP solver.
Definition: ThrustAllocator.cpp:11
std::tuple< bb_controls_msgs::msg::Thrusters, bb_controls_msgs::msg::ThrusterForces, Vector6d > allocate(const Vector6d &force, float battery_voltage)
Allocates a body force to per-thruster commands at the given battery voltage.
Definition: ThrustAllocator.cpp:84
Manages a collection of Thruster objects and builds the allocation matrix.
Definition: ThrusterLayout.h:11