Line data Source code
1 : #ifndef CONTROLS_ALLOCATOR_CONFIG_THRUSTER_LOOKUP_INTERFACE_H 2 : #define CONTROLS_ALLOCATOR_CONFIG_THRUSTER_LOOKUP_INTERFACE_H 3 : 4 : #include <cstdint> 5 : #include <utility> 6 : 7 : /** 8 : * @brief Abstract interface for voltage-dependent thruster lookup tables 9 : * 10 : * Implementations map a desired thrust force (N) at a given battery voltage (V) 11 : * to an integer PWM-style command, and expose the achievable force limits at 12 : * that voltage. 13 : */ 14 1 : class ThrusterLookupInterface { 15 : public: 16 0 : virtual ~ThrusterLookupInterface() = default; 17 : 18 : /** 19 : * @brief Returns the minimum and maximum achievable thrust at a given voltage 20 : * 21 : * @param voltage_v [in] Battery voltage in volts 22 : * 23 : * @return Pair of (min_force_N, max_force_N) 24 : */ 25 1 : virtual std::pair<float, float> getForceLimits(float voltage_v) = 0; 26 : 27 : /** 28 : * @brief Converts a desired thrust and voltage to a thruster command value 29 : * 30 : * @param thrust_N [in] Desired thrust in Newtons 31 : * @param voltage_v [in] Battery voltage in volts 32 : * 33 : * @return Integer thruster command (e.g. PWM microseconds or a scaled value) 34 : */ 35 1 : virtual int16_t getThrusterCommand(float thrust_N, float voltage_v) = 0; 36 : }; 37 : 38 : #endif // CONTROLS_ALLOCATOR_CONFIG_THRUSTER_LOOKUP_INTERFACE_H