Line data Source code
1 : #ifndef CONTROLS_ALLOCATOR_CONFIG_THRUSTER_H 2 : #define CONTROLS_ALLOCATOR_CONFIG_THRUSTER_H 3 : 4 : #include <utils/Types.h> 5 : 6 : #include <string> 7 : 8 : /** 9 : * @brief Represents a single thruster with its physical placement and force direction 10 : */ 11 1 : class Thruster { 12 : public: 13 : /** @brief Unique zero-based index identifying this thruster within the layout */ 14 : uint8_t idx_; 15 : 16 : /** @brief Human-readable thruster name used in log messages */ 17 : std::string name_; 18 : 19 : /** 20 : * @brief Thruster position relative to the vehicle reference point in the body frame (m) 21 : * 22 : * The reference point is typically the centre of mass or buoyancy. 23 : */ 24 : Vector3d position_; 25 : 26 : /** @brief Positional offset applied on top of position (e.g. CG offset correction) */ 27 : Vector3d offset_; 28 : 29 : /** 30 : * @brief Unit vector in the direction of positive thrust in the body frame 31 : * 32 : * For example, (1, 0, 0) means the thruster pushes in the +X direction. 33 : */ 34 : Vector3d positive_force_direction_; 35 : 36 : /** 37 : * @brief Constructs a thruster with all positional and directional parameters 38 : * 39 : * @param name [in] Human-readable identifier 40 : * @param position [in] Position relative to vehicle reference point (m) 41 : * @param offset [in] Additional positional offset (m) 42 : * @param positive_force_direction [in] Unit vector of positive thrust direction 43 : * @param idx [in] Unique zero-based thruster index 44 : */ 45 1 : Thruster(const std::string& name, const Vector3d& position, const Vector3d& offset, 46 : const Vector3d& positive_force_direction, uint8_t idx); 47 : 48 : /** 49 : * @brief Returns the effective position with the CG offset applied 50 : * 51 : * @return position + offset in the body frame (m) 52 : */ 53 1 : Vector3d get_position() const; 54 : 55 : /** 56 : * @brief Returns the unit vector of positive thrust direction 57 : * 58 : * @return Positive force direction in the body frame 59 : */ 60 1 : Vector3d get_positive_force_direction() const; 61 : 62 : /** 63 : * @brief Updates the positional offset for this thruster 64 : * 65 : * @param offset [in] New offset vector in the body frame (m) 66 : */ 67 1 : void set_offset(const Vector3d& offset); 68 : }; 69 : 70 : #endif // CONTROLS_ALLOCATOR_CONFIG_THRUSTER_H