LCOV - code coverage report
Current view: top level - allocator/config - Thruster.h Hit Total Coverage
Test: doc-coverage.info Lines: 8 8 100.0 %
Date: 2026-04-20 18:26:22

          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 positiveForceDirection;
      35             : 
      36             :     /**
      37             :      * @brief True if this thruster participates in the XY-Yaw QP allocation group;
      38             :      *        false if it belongs to the Z-Roll-Pitch group
      39             :      */
      40             :     bool isXY_Yaw;
      41             : 
      42             :     /**
      43             :      * @brief Constructs a thruster with all positional and directional parameters
      44             :      *
      45             :      * @param name                  [in] Human-readable identifier
      46             :      * @param position              [in] Position relative to vehicle reference point (m)
      47             :      * @param offset                [in] Additional positional offset (m)
      48             :      * @param positiveForceDirection [in] Unit vector of positive thrust direction
      49             :      * @param isXY_Yaw              [in] True if this thruster is in the XY-Yaw allocation group
      50             :      * @param idx                   [in] Unique zero-based thruster index
      51             :      */
      52           1 :     Thruster(const std::string& name, const Vector3d& position, const Vector3d& offset,
      53             :              const Vector3d& positiveForceDirection, bool isXY_Yaw, uint8_t idx);
      54             : 
      55             :     /**
      56             :      * @brief Returns the unique thruster index
      57             :      *
      58             :      * @return Zero-based thruster index
      59             :      */
      60           1 :     uint8_t getIdx() const;
      61             : 
      62             :     /**
      63             :      * @brief Returns true if this thruster belongs to the XY-Yaw allocation group
      64             :      *
      65             :      * @return True for XY-Yaw group, false for Z-Roll-Pitch group
      66             :      */
      67           1 :     bool getIsXY_Yaw() const;
      68             : 
      69             :     /**
      70             :      * @brief Returns the nominal position without the CG offset applied
      71             :      *
      72             :      * @return Position vector in the body frame (m)
      73             :      */
      74           1 :     Vector3d getOriginalPosition() const;
      75             : 
      76             :     /**
      77             :      * @brief Returns the effective position with the CG offset applied
      78             :      *
      79             :      * @return position + offset in the body frame (m)
      80             :      */
      81           1 :     Vector3d getPosition() const;
      82             : 
      83             :     /**
      84             :      * @brief Returns the unit vector of positive thrust direction
      85             :      *
      86             :      * @return Positive force direction in the body frame
      87             :      */
      88           1 :     Vector3d getPositiveForceDirection() const;
      89             : 
      90             :     /**
      91             :      * @brief Updates the positional offset for this thruster
      92             :      *
      93             :      * @param offset [in] New offset vector in the body frame (m)
      94             :      */
      95           1 :     void setOffset(const Vector3d& offset);
      96             : };
      97             : 
      98             : #endif  // CONTROLS_ALLOCATOR_CONFIG_THRUSTER_H

Generated by: LCOV version 1.14