MCU
Loading...
Searching...
No Matches
BaseLaunchController.h
Go to the documentation of this file.
1#ifndef __BASELAUNCHCONTROLLER_H__
2#define __BASELAUNCHCONTROLLER_H__
3#include "SharedDataTypes.h"
4#include "BaseController.h"
5#include <algorithm>
6#include <math.h>
7
17{
22};
23
26{
27 const int16_t DEFAULT_LAUNCH_SPEED_TARGET = 1500;
28 const float const_accel_time = 100; // time to use launch speed target in ms
32 const float launch_go_accel_threshold = .9;
34}
35
36class BaseLaunchController : public virtual Controller
37{
38protected:
44 LaunchStates_e launch_state_ = LaunchStates_e::LAUNCH_NOT_READY;
47 int16_t init_speed_target_ = 0;
48
49public:
53 BaseLaunchController(int16_t initial_speed_target)
54 : init_speed_target_(initial_speed_target)
55 {
57 writeout_.ready = true;
58 }
59
66 void tick(const SysTick_s &tick,
67 const PedalsSystemData_s &pedalsData,
68 const float wheel_rpms[],
69 const VectornavData_s &vn_data);
76 virtual void calc_launch_algo(const VectornavData_s &vn_data) = 0;
80};
81#endif // __BASELAUNCHCONTROLLER_H__
LaunchStates_e
Modes to define launch behavior, where each one waits for acceleration request threshold to move to n...
constexpr const float METERS_PER_SECOND_TO_RPM
TorqueControllerOutput_s evaluate(const SharedCarState_s &state) override
all launch controllers share the same evaluate method implemented in this class implementation.
TorqueControllerOutput_s writeout_
LaunchStates_e get_launch_state()
LaunchStates_e launch_state_
BaseLaunchController(int16_t initial_speed_target)
Constructor for parent launch controller.
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....
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...
Base class for all controllers, which define drivetrain command containing different variations of
const DrivetrainCommand_s TC_COMMAND_NO_TORQUE
Definition: BaseController.h:9
contains constants for tick behavior/progression(_threshold variables used to determine when to move ...
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