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

#include <SlipLaunchController.h>

Inheritance diagram for TorqueControllerSlipLaunch:
Inheritance graph
Collaboration diagram for TorqueControllerSlipLaunch:
Collaboration graph

Public Member Functions

 TorqueControllerSlipLaunch (float slip_ratio, int16_t initial_speed_target)
 
 TorqueControllerSlipLaunch ()
 default constructor for slip launch controller: DEFAULT_SLIP_RATIO = 0.2, DEFAULT_LAUNCH_SPEED_TARGET = 1500(rpm) More...
 
void calc_launch_algo (const VectornavData_s &vn_data) override
 Increases speed target during launch linearly according to slip ratio to keep the cars wheels spinning faster than the velocity for increased traction. 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 slip_ratio_
 

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 10 of file SlipLaunchController.h.

Constructor & Destructor Documentation

◆ TorqueControllerSlipLaunch() [1/2]

TorqueControllerSlipLaunch::TorqueControllerSlipLaunch ( float  slip_ratio,
int16_t  initial_speed_target 
)
inline

SLIP LAUNCH CONTROLLER This launch controller is based off of a specified slip constant. It will at all times attempt to keep the wheelspeed at this certain higher percent of the body velocity of the car to keep it in constant slip

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

Definition at line 24 of file SlipLaunchController.h.

◆ TorqueControllerSlipLaunch() [2/2]

TorqueControllerSlipLaunch::TorqueControllerSlipLaunch ( )
inline

default constructor for slip launch controller: DEFAULT_SLIP_RATIO = 0.2, DEFAULT_LAUNCH_SPEED_TARGET = 1500(rpm)

Definition at line 28 of file SlipLaunchController.h.

TorqueControllerSlipLaunch()
default constructor for slip launch controller: DEFAULT_SLIP_RATIO = 0.2, DEFAULT_LAUNCH_SPEED_TARGET...
const int16_t DEFAULT_LAUNCH_SPEED_TARGET

Member Function Documentation

◆ calc_launch_algo()

void TorqueControllerSlipLaunch::calc_launch_algo ( const VectornavData_s vn_data)
overridevirtual

Increases speed target during launch linearly according to slip ratio to keep the cars wheels spinning faster than the velocity for increased traction.

Parameters
vn_dataThis controller needs velocity data for to keep updating increasing the speed according to the slip ratio

Implements BaseLaunchController.

Definition at line 47 of file LaunchControllerAlgos.cpp.

48{
49 // accelerate at constant speed for a period of time to get body velocity up
50 // may want to make this the ht07 launch algo
51
52 // makes sure that the car launches at the target launch speed
54
55 /*
56 New slip-ratio based launch algorithm by Luke Chen. The basic idea
57 is to always be pushing the car a certain 'slip_ratio_' faster than
58 the car is currently going, theoretically always keeping the car in slip
59 */
60 // m/s
61 float new_speed_target = (1 + slip_ratio_) * (vn_data.velocity_x);
62 // rpm
63 new_speed_target *= METERS_PER_SECOND_TO_RPM;
64 // makes sure the car target speed never goes lower than prev. target
65 // allows for the vn to 'spool' up and us to get reliable vx data
66 launch_speed_target_ = std::max(launch_speed_target_, new_speed_target);
67}
constexpr const float METERS_PER_SECOND_TO_RPM

Member Data Documentation

◆ slip_ratio_

float TorqueControllerSlipLaunch::slip_ratio_
private

Definition at line 13 of file SlipLaunchController.h.


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