#include <BaseLaunchController.h>
|
| | BaseLaunchController (int16_t initial_speed_target) |
| | Constructor for parent launch controller. More...
|
| |
| void | tick (const SysTick_s &tick, const PedalsSystemData_s &pedalsData, const float wheel_rpms[], const VectornavData_s &vn_data) |
| | ticks launch controller to progress through launch states when conditions are met. The conditions are explained above the launch states enum. all launch controllers use this class' implementation of tick. tick conatains the current system tick controlled by main.cpp pedalsData conatins the brake and accelerator values wheel_rpms[] contains how fast each wheel is spinning, order of wheels in this array is defined in SharedDataTypes.h and Utility.h vn_data contains vector states of the car that will be provided to the calc_launch_algo method called in the LAUNCHING state of this set of modes More...
|
| |
| LaunchStates_e | get_launch_state () |
| |
| virtual void | calc_launch_algo (const VectornavData_s &vn_data)=0 |
| | calculates how speed target (the speed the car is trying to achieve during launch) is set and/or increased during launch This updates internal speed target variable launch_speed_target_ More...
|
| |
| TorqueControllerOutput_s | evaluate (const SharedCarState_s &state) override |
| | all launch controllers share the same evaluate method implemented in this class implementation. More...
|
| |
| virtual TorqueControllerOutput_s | evaluate (const SharedCarState_s &state)=0 |
| | This mehod must be implemented by every controller in the Tc Muxer. This is called in the Muxer whenever the drivetrain command is obtained. TorqueControllerMux.cpp to see that in every tick of the system, the active controller must be ticked through this method. More...
|
| |
Definition at line 36 of file BaseLaunchController.h.
◆ BaseLaunchController()
| BaseLaunchController::BaseLaunchController |
( |
int16_t |
initial_speed_target | ) |
|
|
inline |
Constructor for parent launch controller.
- Parameters
-
| initial_speed_target | used only in simple launch controller algorithm |
- Note
- requires one method: calc_launch_algo
Definition at line 53 of file BaseLaunchController.h.
55 {
58 }
TorqueControllerOutput_s writeout_
int16_t init_speed_target_
const DrivetrainCommand_s TC_COMMAND_NO_TORQUE
DrivetrainCommand_s command
◆ calc_launch_algo()
| virtual void BaseLaunchController::calc_launch_algo |
( |
const VectornavData_s & |
vn_data | ) |
|
|
pure virtual |
calculates how speed target (the speed the car is trying to achieve during launch) is set and/or increased during launch This updates internal speed target variable launch_speed_target_
- Parameters
-
| vn_data | vector data needed for calulations eg. speed and coordinates |
- Note
- defines important variation in launch controller tick/evaluation as the launch controllers share a tick method defined in this parent class implementation
-
all launch algorithms are implemented in LaunchControllerAlgos.cpp
Implemented in TorqueControllerLookupLaunch, TorqueControllerSimpleLaunch, and TorqueControllerSlipLaunch.
◆ evaluate()
all launch controllers share the same evaluate method implemented in this class implementation.
- Note
- refer to parent class for function documentation
Implements Controller.
Definition at line 110 of file BaseLaunchController.cpp.
111{
114}
void tick(const SysTick_s &tick, const PedalsSystemData_s &pedalsData, const float wheel_rpms[], const VectornavData_s &vn_data)
ticks launch controller to progress through launch states when conditions are met....
speed_rpm measuredSpeeds[NUM_MOTORS]
PedalsSystemData_s pedals_data
DrivetrainDynamicReport_s drivetrain_data
◆ get_launch_state()
◆ tick()
ticks launch controller to progress through launch states when conditions are met. The conditions are explained above the launch states enum. all launch controllers use this class' implementation of tick. tick conatains the current system tick controlled by main.cpp pedalsData conatins the brake and accelerator values wheel_rpms[] contains how fast each wheel is spinning, order of wheels in this array is defined in SharedDataTypes.h and Utility.h vn_data contains vector states of the car that will be provided to the calc_launch_algo method called in the LAUNCHING state of this set of modes
Definition at line 3 of file BaseLaunchController.cpp.
8{
9
10 if (
tick.triggers.trigger100)
11 {
12
14
16
17 float max_speed = 0;
18 for (int i = 0; i < 4; i++)
19 {
20 max_speed = std::max(max_speed, abs(wheel_rpms[i]));
21 }
22
24
26 {
27 case LaunchStates_e::LAUNCH_NOT_READY:
28
33
38
39
42
44 {
46 }
47
48 break;
49 case LaunchStates_e::LAUNCH_READY:
50
55
60
61
64
65
67 {
69 }
71 {
72
76
78 }
79
80
81 break;
82 case LaunchStates_e::LAUNCHING:
83 {
84
86 {
88 }
89
91
96
101
102 break;
103 }
104 default:
105 break;
106 }
107 }
108}
float launch_speed_target_
virtual void calc_launch_algo(const VectornavData_s &vn_data)=0
calculates how speed target (the speed the car is trying to achieve during launch) is set and/or incr...
const float launch_go_accel_threshold
const float launch_ready_brake_threshold
const float launch_ready_accel_threshold
const float launch_ready_speed_threshold
const float launch_stop_accel_threshold
const float AMK_MAX_TORQUE
const float MAX_REGEN_TORQUE
float inverter_torque_limit[NUM_MOTORS]
float speeds_rpm[NUM_MOTORS]
◆ current_millis_
| uint32_t BaseLaunchController::current_millis_ |
|
protected |
◆ init_speed_target_
| int16_t BaseLaunchController::init_speed_target_ = 0 |
|
protected |
◆ initial_ecef_x_
| double BaseLaunchController::initial_ecef_x_ |
|
protected |
◆ initial_ecef_y_
| double BaseLaunchController::initial_ecef_y_ |
|
protected |
◆ initial_ecef_z_
| double BaseLaunchController::initial_ecef_z_ |
|
protected |
◆ launch_speed_target_
| float BaseLaunchController::launch_speed_target_ = 0.0 |
|
protected |
◆ launch_state_
| LaunchStates_e BaseLaunchController::launch_state_ = LaunchStates_e::LAUNCH_NOT_READY |
|
protected |
◆ time_of_launch_
| uint32_t BaseLaunchController::time_of_launch_ |
|
protected |
◆ writeout_
The documentation for this class was generated from the following files: