MCU
Loading...
Searching...
No Matches
LoadCellVectoringController.h
Go to the documentation of this file.
1#ifndef LOADCELLVECTORINGCONTROLLER
2#define LOADCELLVECTORINGCONTROLLER
3
4#include "BaseController.h"
6{
7private:
8 float frontTorqueScale_ = 1.0;
9 float rearTorqueScale_ = 1.0;
12
14 /*
15 FIR filter designed with
16 http://t-filter.appspot.com
17
18 sampling frequency: 100 Hz
19
20 * 0 Hz - 10 Hz
21 gain = 1
22 desired ripple = 5 dB
23 actual ripple = 1.7659949026015025 dB
24
25 * 40 Hz - 50 Hz
26 gain = 0
27 desired attenuation = -40 dB
28 actual attenuation = -47.34009380570117 dB
29 */
30 const static int numFIRTaps_ = 5;
32 0.07022690881526232,
33 0.27638313122745306,
34 0.408090001549378,
35 0.27638313122745306,
36 0.07022690881526232};
37 int FIRCircBufferHead = 0; // index of the latest sample in the raw buffer
40 // Some checks that can disable the controller
41 const int errorCountThreshold_ = 25;
43 bool FIRSaturated_ = false;
44 bool ready_ = false;
45
46public:
51 TorqueControllerLoadCellVectoring(float rearTorqueScale, float regenTorqueScale)
52 : frontTorqueScale_(2.0 - rearTorqueScale),
53 rearTorqueScale_(rearTorqueScale),
54 frontRegenTorqueScale_(2.0 - regenTorqueScale),
55 rearRegenTorqueScale_(regenTorqueScale)
56 {
58 writeout_.ready = false;
59 }
62
67 void tick(
68 const SysTick_s &tick,
69 const PedalsSystemData_s &pedalsData,
70 const LoadCellInterfaceOutput_s &loadCellData);
73};
74
75#endif
Base class for all controllers, which define drivetrain command containing different variations of
TorqueControllerLoadCellVectoring()
default contructor with balanced default values: rearTorqueScale = 1.0, regenTorqueScale = 1....
void tick(const SysTick_s &tick, const PedalsSystemData_s &pedalsData, const LoadCellInterfaceOutput_s &loadCellData)
Calculates speed set point based on normal force applied to wheels individually.
TorqueControllerLoadCellVectoring(float rearTorqueScale, float regenTorqueScale)
load cell TC with tunable F/R torque balance. Accel torque balance can be tuned independently of rege...
TorqueControllerOutput_s evaluate(const SharedCarState_s &state) override
const DrivetrainCommand_s TC_COMMAND_NO_TORQUE
Definition: BaseController.h:9
car state struct that contains state of everything about the car including
Packages drivetrain command with ready boolean to give feedback on controller successfully evaluating...
DrivetrainCommand_s command