-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
seemingly working ethernet integration
- Loading branch information
Showing
9 changed files
with
64 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
#include "DrivebrainETHInterface.h" | ||
|
||
#include "SharedDataTypes.h" | ||
#include <Arduino.h> | ||
void DrivebrainETHInterface::receive_pb_msg(const hytech_msgs_MCUData& msg_in) | ||
|
||
hytech_msgs_MCUOutputData DrivebrainETHInterface::make_db_msg(const SharedCarState_s &shared_state) | ||
{ | ||
hytech_msgs_MCUOutputData out; | ||
out.accel_percent = shared_state.pedals_data.accelPercent; | ||
out.brake_percent = shared_state.pedals_data.brakePercent; | ||
out.rpm_data = {shared_state.drivetrain_data.measuredSpeeds[0], | ||
shared_state.drivetrain_data.measuredSpeeds[1], | ||
shared_state.drivetrain_data.measuredSpeeds[2], | ||
shared_state.drivetrain_data.measuredSpeeds[3]}; | ||
return out; | ||
} | ||
|
||
void DrivebrainETHInterface::receive_pb_msg(const hytech_msgs_MCUCommandData &msg_in, unsigned long curr_millis) | ||
{ | ||
Serial.println("msg recvd"); | ||
_latest_data = {}; | ||
// Serial.println("msg recvd in here"); | ||
veh_vec<float> nm_lim; | ||
nm_lim.construct(msg_in.torque_limit_nm.FL, msg_in.torque_limit_nm.FR, msg_in.torque_limit_nm.RL, msg_in.torque_limit_nm.RR); | ||
|
||
veh_vec<float> speed_set; | ||
speed_set.construct(msg_in.desired_rpms.FL, msg_in.desired_rpms.FR, msg_in.desired_rpms.RL, msg_in.desired_rpms.RR); | ||
// Serial.println(msg_in.desired_rpms.FL); | ||
|
||
_latest_data.torque_limits_nm = nm_lim; | ||
_latest_data.speed_setpoints_rpm = speed_set; | ||
_latest_data.last_torque_lim_receive_time_millis = curr_millis; | ||
_latest_data.last_speed_setpoint_receive_time_millis = curr_millis; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters