MCU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
TorqueControllerSimpleLaunch Class Reference

#include <SimpleLaunchController.h>

Inheritance diagram for TorqueControllerSimpleLaunch:
Inheritance graph
Collaboration diagram for TorqueControllerSimpleLaunch:
Collaboration graph

Public Member Functions

 TorqueControllerSimpleLaunch (float launch_rate, int16_t initial_speed_target)
 this launch controller is based off of a specified launch rate and an initial speed target It will ramp up the speed target linearly over time to accelerate More...
 
 TorqueControllerSimpleLaunch ()
 base constructor with default values: Default_Launch_Rate = 11.76, DEFAULT_LAUNCH_SPEED_TARGET = 1500(rpm) More...
 
void calc_launch_algo (const VectornavData_s &vn_data) override
 Increases speed target during launch linearly based off launch rate provided in the constructor. More...
 
- Public Member Functions inherited from BaseLaunchController
 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...
 

Private Attributes

float launch_rate_target_
 

Additional Inherited Members

- Protected Attributes inherited from BaseLaunchController
TorqueControllerOutput_s writeout_
 
uint32_t time_of_launch_
 
double initial_ecef_x_
 
double initial_ecef_y_
 
double initial_ecef_z_
 
LaunchStates_e launch_state_ = LaunchStates_e::LAUNCH_NOT_READY
 
uint32_t current_millis_
 
float launch_speed_target_ = 0.0
 
int16_t init_speed_target_ = 0
 

Detailed Description

Definition at line 14 of file SimpleLaunchController.h.

Constructor & Destructor Documentation

◆ TorqueControllerSimpleLaunch() [1/2]

TorqueControllerSimpleLaunch::TorqueControllerSimpleLaunch ( float  launch_rate,
int16_t  initial_speed_target 
)
inline

this launch controller is based off of a specified launch rate and an initial speed target It will ramp up the speed target linearly over time to accelerate

SIMPLE LAUNCH CONTROLLER

Parameters
launch_ratespecified launch rate in m/s^2
initial_speed_targetthe initial speed commanded to the wheels

Definition at line 27 of file SimpleLaunchController.h.

◆ TorqueControllerSimpleLaunch() [2/2]

TorqueControllerSimpleLaunch::TorqueControllerSimpleLaunch ( )
inline

base constructor with default values: Default_Launch_Rate = 11.76, DEFAULT_LAUNCH_SPEED_TARGET = 1500(rpm)

Definition at line 32 of file SimpleLaunchController.h.

TorqueControllerSimpleLaunch()
base constructor with default values: Default_Launch_Rate = 11.76, DEFAULT_LAUNCH_SPEED_TARGET = 1500...

Member Function Documentation

◆ calc_launch_algo()

void TorqueControllerSimpleLaunch::calc_launch_algo ( const VectornavData_s vn_data)
overridevirtual

Increases speed target during launch linearly based off launch rate provided in the constructor.

Parameters
vn_datathis data is not necessary for this controller but is supplied according to the interface

Implements BaseLaunchController.

Definition at line 6 of file LaunchControllerAlgos.cpp.

7{
8 /*
9 Stolen launch algo from HT07. This ramps up the speed target over time.
10 launch rate target is m/s^2 and is the target acceleration rate
11 secs_since_launch takes the milliseconds since launch started and converts to sec
12 This is then converted to RPM for a speed target
13 There is an initial speed target that is your iitial instant acceleration on the wheels
14 */
15 float secs_since_launch = (float)(current_millis_ - time_of_launch_) / 1000.0;
16 launch_speed_target_ = (int16_t)((float)secs_since_launch * launch_rate_target_ * METERS_PER_SECOND_TO_RPM);
19}
constexpr const float METERS_PER_SECOND_TO_RPM

Member Data Documentation

◆ launch_rate_target_

float TorqueControllerSimpleLaunch::launch_rate_target_
private

Definition at line 17 of file SimpleLaunchController.h.


The documentation for this class was generated from the following files: