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

#include <DrivebrainETHInterface.h>

Collaboration diagram for DrivebrainETHInterface:
Collaboration graph

Public Member Functions

 DrivebrainETHInterface ()
 
void receive_pb_msg (const hytech_msgs_MCUCommandData &msg_in, unsigned long curr_millis)
 
hytech_msgs_MCUOutputData make_db_msg (const SharedCarState_s &shared_state)
 
DrivebrainData_s get_latest_data ()
 

Private Attributes

DrivebrainData_s _latest_data = {}
 

Detailed Description

Definition at line 6 of file DrivebrainETHInterface.h.

Constructor & Destructor Documentation

◆ DrivebrainETHInterface()

DrivebrainETHInterface::DrivebrainETHInterface ( )
inline

Definition at line 9 of file DrivebrainETHInterface.h.

9 {
12 };
int64_t last_receive_time_millis
the latest time that the MCU received a message w.r.t the current tick's millis
Definition: DrivebrainData.h:9
int64_t DB_prev_MCU_recv_millis
the latest MCU last_receive_time_millis that the drivebrain received

Member Function Documentation

◆ get_latest_data()

DrivebrainData_s DrivebrainETHInterface::get_latest_data ( )
inline

Definition at line 17 of file DrivebrainETHInterface.h.

17{ return _latest_data; }

◆ make_db_msg()

hytech_msgs_MCUOutputData DrivebrainETHInterface::make_db_msg ( const SharedCarState_s shared_state)

Definition at line 5 of file DrivebrainETHInterface.cpp.

6{
7 hytech_msgs_MCUOutputData out;
8 out.accel_percent = shared_state.pedals_data.accelPercent;
9 out.brake_percent = shared_state.pedals_data.regenPercent;
10
11 out.has_rpm_data = true;
12 out.rpm_data.FL = shared_state.drivetrain_data.measuredSpeeds[0];
13 out.rpm_data.FR = shared_state.drivetrain_data.measuredSpeeds[1];
14 out.rpm_data.RL = shared_state.drivetrain_data.measuredSpeeds[2];
15 out.rpm_data.RR = shared_state.drivetrain_data.measuredSpeeds[3];
16 out.steering_angle_deg = shared_state.steering_data.angle;
17 out.MCU_recv_millis = _latest_data.last_receive_time_millis;
18 out.load_cell_data = {shared_state.raw_loadcell_data.raw_load_cell_data.FL,
22 out.has_load_cell_data = true;
23
24 out.timing_failure_active = shared_state.drivebrain_timing_failure;
25 return out;
26}
speed_rpm measuredSpeeds[NUM_MOTORS]
SteeringSystemData_s steering_data
PedalsSystemData_s pedals_data
DrivetrainDynamicReport_s drivetrain_data
LoadCellInterfaceRawOutput_s raw_loadcell_data
T FL
Definition: Utility.h:19
T RL
Definition: Utility.h:21
T RR
Definition: Utility.h:22
T FR
Definition: Utility.h:20

◆ receive_pb_msg()

void DrivebrainETHInterface::receive_pb_msg ( const hytech_msgs_MCUCommandData &  msg_in,
unsigned long  curr_millis 
)

Definition at line 28 of file DrivebrainETHInterface.cpp.

29{
30 veh_vec<float> nm_lim(msg_in.torque_limit_nm.FL, msg_in.torque_limit_nm.FR, msg_in.torque_limit_nm.RL, msg_in.torque_limit_nm.RR);
31 veh_vec<float> speed_set(msg_in.desired_rpms.FL, msg_in.desired_rpms.FR, msg_in.desired_rpms.RL, msg_in.desired_rpms.RR);
34 _latest_data.DB_prev_MCU_recv_millis = msg_in.prev_MCU_recv_millis;
35 _latest_data.last_receive_time_millis = curr_millis; // current tick millis
36}
veh_vec< float > speed_setpoints_rpm
veh_vec< float > torque_limits_nm
generic data vector type that can be used with tire and / or anything to do with 4 corners of the car...
Definition: Utility.h:17

Member Data Documentation

◆ _latest_data

DrivebrainData_s DrivebrainETHInterface::_latest_data = {}
private

Definition at line 21 of file DrivebrainETHInterface.h.


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