|
MCU
|
#include <TorqueControllerMux.h>

Public Member Functions | |
| TorqueControllerMux ()=delete | |
| TorqueControllerMux (std::array< Controller *, num_controllers > controller_pointers, std::array< bool, num_controllers > mux_bypass_limits, float max_change_speed=TC_MUX_DEFAULT_PARAMS::MAX_SPEED_FOR_MODE_CHANGE, float max_torque_pos_change_delta=TC_MUX_DEFAULT_PARAMS::MAX_TORQUE_DELTA_FOR_MODE_CHANGE, float max_power_limit=TC_MUX_DEFAULT_PARAMS::MAX_POWER_LIMIT) | |
| constructor for the TC mux More... | |
| const TorqueControllerMuxStatus & | get_tc_mux_status () |
| DrivetrainCommand_s | getDrivetrainCommand (ControllerMode_e requested_controller_type, TorqueLimit_e controller_command_torque_limit, const SharedCarState_s &input_state) |
| function that evaluates the mux, controllers and gets the active command More... | |
Private Member Functions | |
| TorqueControllerMuxError | can_switch_controller_ (DrivetrainDynamicReport_s active_drivetrain_data, DrivetrainCommand_s previous_controller_command, DrivetrainCommand_s desired_controller_out) |
| DrivetrainCommand_s | apply_positive_speed_limit_ (const DrivetrainCommand_s &command) |
| Clamps negative rpms to 0f. More... | |
| DrivetrainCommand_s | apply_torque_limit_ (const DrivetrainCommand_s &command, float max_torque) |
| Ensure torque is at most at the specified limit. If exceeding, then limit it in the returned DrivetrainCommand_s. More... | |
| DrivetrainCommand_s | apply_power_limit_ (const DrivetrainCommand_s &command, const DrivetrainDynamicReport_s &drivetrain, float power_limit, float max_torque) |
| Apply power limit (watts) such that the mechanical power of all wheels never exceeds the preset mechanical power limit. Scales all wheels down to preserve functionality of torque controllers. More... | |
| DrivetrainCommand_s | apply_regen_limit_ (const DrivetrainCommand_s &command, const DrivetrainDynamicReport_s &drivetrain_data) |
| begin limiting regen at noRegenLimitKPH (hardcoded in func) and completely limit regen at fullRegenLimitKPH (hardcoded in func) More... | |
Private Attributes | |
| std::array< Controller *, num_controllers > | controller_pointers_ |
| std::array< bool, num_controllers > | mux_bypass_limits_ |
| std::unordered_map< TorqueLimit_e, float > | torque_limit_map_ |
| float | max_change_speed_ |
| float | max_torque_pos_change_delta_ |
| float | max_power_limit_ |
| DrivetrainCommand_s | prev_command_ = {} |
| TorqueControllerMuxStatus | active_status_ = {} |
Definition at line 60 of file TorqueControllerMux.h.
|
delete |
|
inlineexplicit |
constructor for the TC mux
| controller_pointers | the array of pointers to the controllers being muxed between |
| mux_bypass_limits | the array of aligned bools for determining if the limits should be applied to the controller outputs defaults to TC_MUX_DEFAULT_PARAMS::MAX_SPEED_FOR_MODE_CHANGE |
| max_change_speed | the max speed difference between the requested controller output and the actual speed of each wheel that if the controller has a diff larger than the mux will not switch to the requested controller |
| max_torque_pos_change_delta | same as speed but evaluated between the controller commanded torques defaults to TC_MUX_DEFAULT_PARAMS::MAX_TORQUE_DELTA_FOR_MODE_CHANGE |
| max_power_limit | the max power limit defaults to TC_MUX_DEFAULT_PARAMS::MAX_POWER_LIMIT |
Definition at line 116 of file TorqueControllerMux.h.
|
private |
Clamps negative rpms to 0f.
| const | DrivetrainCommand_s &command provides the rpm info as a DrivetrainCommand_s |
|
private |
Apply power limit (watts) such that the mechanical power of all wheels never exceeds the preset mechanical power limit. Scales all wheels down to preserve functionality of torque controllers.
| const | DrivetrainCommand_s &command provides torque info, which is used to calculate mechanical power |
| const | DrivetrainDynamicReport_s &drivetrain provides RPMS, which are used to calculate radians / s |
| float | max_torque is used to indirectly specifiy the max power |
|
private |
begin limiting regen at noRegenLimitKPH (hardcoded in func) and completely limit regen at fullRegenLimitKPH (hardcoded in func)
| const | DrivetrainCommand_s &command |
| const | DrivetrainDynamicReport_s &drivetrain_data provides RPMs |
|
private |
Ensure torque is at most at the specified limit. If exceeding, then limit it in the returned DrivetrainCommand_s.
| const | DrivetrainCommand_s &command is a DrivetrainCommand_s, which provides torque info |
| float | max_torque this is the maximum average torque the wheels are allowed to experience before it is limited. |
|
private |
|
inline |
Definition at line 132 of file TorqueControllerMux.h.
| DrivetrainCommand_s TorqueControllerMux< num_controllers >::getDrivetrainCommand | ( | ControllerMode_e | requested_controller_type, |
| TorqueLimit_e | controller_command_torque_limit, | ||
| const SharedCarState_s & | input_state | ||
| ) |
function that evaluates the mux, controllers and gets the active command
| requested_controller_type | the requested controller type from the dial state |
| controller_command_torque_limit | the torque limit state enum set by dashboard |
| input_state | the active state of the car |
|
private |
Definition at line 77 of file TorqueControllerMux.h.
|
private |
Definition at line 67 of file TorqueControllerMux.h.
|
private |
Definition at line 75 of file TorqueControllerMux.h.
|
private |
Definition at line 75 of file TorqueControllerMux.h.
|
private |
Definition at line 75 of file TorqueControllerMux.h.
|
private |
Definition at line 69 of file TorqueControllerMux.h.
|
private |
Definition at line 76 of file TorqueControllerMux.h.
|
private |
Definition at line 71 of file TorqueControllerMux.h.