diff --git a/lib/shared_data/include/SharedDataTypes.h b/lib/shared_data/include/SharedDataTypes.h index 2e399a6df..9e0817afb 100644 --- a/lib/shared_data/include/SharedDataTypes.h +++ b/lib/shared_data/include/SharedDataTypes.h @@ -5,6 +5,7 @@ #include "SysClock.h" #include "SharedFirmwareTypes.h" +/// @brief defines modes of torque limit to be processed in torque limit map for exact values enum class TorqueLimit_e { TCMUX_FULL_TORQUE = 0, @@ -49,12 +50,15 @@ struct DrivetrainDynamicReport_s float measuredTorqueCurrents[NUM_MOTORS]; float measuredMagnetizingCurrents[NUM_MOTORS]; }; +/// @brief stores two arrays of size equal to the amount of motors: speed setpoints and necessary torque to reach those setpoints struct DrivetrainCommand_s { float speeds_rpm[NUM_MOTORS]; float torqueSetpoints[NUM_MOTORS]; // FIXME: misnomer. This represents the magnitude of the torque the inverter can command to reach the commanded speed setpoint }; +/// @brief Packages drivebrain command with ready boolean +///@note returned by all car controllers evaluate method struct TorqueControllerOutput_s { DrivetrainCommand_s command; @@ -80,6 +84,7 @@ struct VectornavData_s xyz_vec angular_rates; }; +/// @brief Defins errors for TC Mux to use to maintain system safety enum class TorqueControllerMuxError { NO_ERROR = 0, @@ -89,6 +94,7 @@ enum class TorqueControllerMuxError ERROR_CONTROLLER_NULL_POINTER =4 }; +/// @brief packages TC Mux indicators: errors, mode, torque limit, bypass struct TorqueControllerMuxStatus { TorqueControllerMuxError current_error; diff --git a/lib/systems/include/CASESystem.h b/lib/systems/include/CASESystem.h index 5e5c962f2..a28f07198 100644 --- a/lib/systems/include/CASESystem.h +++ b/lib/systems/include/CASESystem.h @@ -148,10 +148,17 @@ class CASESystem DrivetrainCommand_s get_current_drive_command() { return current_command_; } + /// @brief uses pedal data to determine the requested torque by the car + /// @param PedalsSystemData_s &pedals_data + /// @param float max_torque + /// @param float max_regen_torque + /// @param float max_rpm + /// @return float representing the calculated request float calculate_torque_request(const PedalsSystemData_s &pedals_data, float max_torque, float max_regen_torque, float max_rpm); - /// @brief configuration function to determine what CASE is using / turn on and off different features within CASE - /// @param config the configuration struct we will be setting + /// @brief retrieves rpm setpoint based on final torque value + /// @param float final_torque + /// @return The maximum RPM from the configuration if torque is positive, otherwise 0. float get_rpm_setpoint(float final_torque) { if (final_torque > 0) diff --git a/lib/systems/include/Controllers/CASEControllerWrapper.h b/lib/systems/include/Controllers/CASEControllerWrapper.h index 8e0dbd7e8..7edc280e6 100644 --- a/lib/systems/include/Controllers/CASEControllerWrapper.h +++ b/lib/systems/include/Controllers/CASEControllerWrapper.h @@ -9,10 +9,14 @@ class TorqueControllerCASEWrapper : public virtual Controller { public: TorqueControllerCASEWrapper() = delete; - + /// @brief makes CASE system apart of Controller hierarchy for use in TC Mux + /// @param case_instance TorqueControllerCASEWrapper(CASESystem *case_instance) : case_instance_(case_instance) { } + /// @brief packages CASE system command into Torque Controller Output + /// @param SharedCarState_s &state + /// @return TorqueControllerOutput_s TorqueControllerOutput_s evaluate(const SharedCarState_s &state) override { DrivetrainCommand_s curr_cmd = case_instance_->get_current_drive_command();