MCU
Loading...
Searching...
No Matches
SimpleController.cpp
Go to the documentation of this file.
2
4{
5
6 // Both pedals are not pressed and no implausibility has been detected
7 // accelRequest goes between 1.0 and -1.0
8 float accelRequest = pedalsData.accelPercent - pedalsData.regenPercent;
9 float torqueRequest;
10
11 if (accelRequest >= 0.0)
12 {
13 // Positive torque request
14 torqueRequest = accelRequest * PhysicalParameters::AMK_MAX_TORQUE;
15
20
25 }
26 else
27 {
28 // Negative torque request
29 torqueRequest = PhysicalParameters::MAX_REGEN_TORQUE * accelRequest * -1.0;
30
35
40 }
41}
42
44{
45 tick(state.pedals_data);
46 return writeout_;
47}
const int RR
Definition: Utility.h:9
const int FL
Definition: Utility.h:6
const int FR
Definition: Utility.h:7
const int RL
Definition: Utility.h:8
TorqueControllerOutput_s writeout_
void tick(const PedalsSystemData_s &pedalsData)
calculates torque output based off max torque and simple torque scaling metric defined in constructor...
TorqueControllerOutput_s evaluate(const SharedCarState_s &state) override
const float AMK_MAX_TORQUE
const float MAX_REGEN_TORQUE
float inverter_torque_limit[NUM_MOTORS]
float speeds_rpm[NUM_MOTORS]
car state struct that contains state of everything about the car including
PedalsSystemData_s pedals_data
Packages drivetrain command with ready boolean to give feedback on controller successfully evaluating...
DrivetrainCommand_s command