|
MCU
|
Drivebrain Controller for fail-safe pass-through control of the car RESPONSIBILITIES AND DOCUMENTATION. More...
#include <DrivebrainController.h>


Public Member Functions | |
| DrivebrainController (unsigned long allowed_latency, ControllerMode_e assigned_controller_mode=ControllerMode_e::MODE_4) | |
| constructor for the drivebrain controller class More... | |
| TorqueControllerOutput_s | evaluate (const SharedCarState_s &state) |
| evaluate function for running the business logic More... | |
| bool | get_timing_failure_status () |
| getter for the current status of whether or not the controller has had a timing failure during operation 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 | |
| struct { | |
| unsigned long allowed_latency | |
| ControllerMode_e assigned_controller_mode | |
| } | _params |
| unsigned long | _last_worst_latency_timestamp |
| int64_t | _worst_latency_so_far |
| bool | _timing_failure = false |
| unsigned long | _last_setpoint_millis = -1 |
| TorqueControllerSimple | _emergency_control |
Drivebrain Controller for fail-safe pass-through control of the car RESPONSIBILITIES AND DOCUMENTATION.
this class is the "controller" that allows for pass-through control as commanded by the drivebrain. It also calculates the latency of the most recent input and checks to see if the most recent input is still valid and has not expired. If the input has expired then it switches over to the fail-safe control mode (MODE0) to allow for safe failing even while the car is driving so that we dont lose hard-braking capabilities.
This class can clear it's own fault by switching off of this operating mode and then swapping back to this operating mode. The fault clears the first time this controller gets evaluated while switch from the swapped-to mode back to this pass through mode.
latency measurement:
config:
Definition at line 52 of file DrivebrainController.h.
|
inline |
constructor for the drivebrain controller class
| allowed_latency | the allowed latency in milliseconds for which if the most recent packet has a timestamp older than this measure of time we fail safe |
| assigned_controller_mode | the controller mode that the drivebrain controller is assigned to. is required for evaluating whether or not we are active or not |
Definition at line 59 of file DrivebrainController.h.
|
virtual |
evaluate function for running the business logic
| state | the current state of the car |
Implements Controller.
Definition at line 3 of file DrivebrainController.cpp.
|
inline |
getter for the current status of whether or not the controller has had a timing failure during operation
Definition at line 75 of file DrivebrainController.h.
|
private |
Definition at line 88 of file DrivebrainController.h.
|
private |
Definition at line 87 of file DrivebrainController.h.
|
private |
Definition at line 84 of file DrivebrainController.h.
| struct { ... } DrivebrainController::_params |
|
private |
Definition at line 86 of file DrivebrainController.h.
|
private |
Definition at line 85 of file DrivebrainController.h.
| unsigned long DrivebrainController::allowed_latency |
Definition at line 80 of file DrivebrainController.h.
| ControllerMode_e DrivebrainController::assigned_controller_mode |
Definition at line 81 of file DrivebrainController.h.