controls  3.0.0
Public Member Functions | List of all members
ThrustAllocator Class Reference

Converts a 6DOF body force vector to per-thruster PWM commands. More...

#include <ThrustAllocator.h>

Public Member Functions

 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. More...
 
std::tuple< bb_controls_msgs::msg::Thrusters, bb_controls_msgs::msg::ThrusterForces, Vector6dallocate (const Vector6d &force, float battery_voltage)
 Allocates a body force to per-thruster commands at the given battery voltage. More...
 
void update_cg_offset (const Vector3d &updated_cg_offset)
 Updates the centre-of-gravity offset applied to all thruster positions. More...
 

Detailed Description

Converts a 6DOF body force vector to per-thruster PWM commands.

Loads thruster geometry from a YAML configuration file, delegates force allocation to a pluggable QP solver, and converts resulting thruster force magnitudes to integer commands via a ThrusterLookupInterface. The centre- of-gravity offset can be updated at runtime and will trigger an automatic re-initialisation on the next allocate() call.

Constructor & Destructor Documentation

◆ ThrustAllocator()

ThrustAllocator::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.

Parameters
thruster_lookup[in] Voltage-dependent thrust lookup table implementation
solver[in] QP thrust allocation solver implementation
yaml_config_filename[in] Path to the YAML file describing the thruster layout
Exceptions
std::runtime_errorif the YAML file cannot be parsed

Member Function Documentation

◆ allocate()

std::tuple< bb_controls_msgs::msg::Thrusters, bb_controls_msgs::msg::ThrusterForces, Vector6d > ThrustAllocator::allocate ( const Vector6d force,
float  battery_voltage 
)

Allocates a body force to per-thruster commands at the given battery voltage.

Re-initialises the solver if the CG offset has changed since the last call.

Parameters
force[in] Desired 6DOF body force/torque vector in N and Nm
battery_voltage[in] Battery voltage in volts (used to look up force limits)
Returns
Tuple of (PWM command message, per-thruster force message, achieved body force)

◆ update_cg_offset()

void ThrustAllocator::update_cg_offset ( const Vector3d &  updated_cg_offset)

Updates the centre-of-gravity offset applied to all thruster positions.

The solver is lazily re-initialised on the next allocate() call.

Parameters
updated_cg_offset[in] New CG offset in the body frame (m)

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