Skip to content

Commit

Permalink
updated pedal constants and added in new drivebrain interface updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RCMast3r committed Nov 10, 2024
1 parent 6afeb7b commit d33d69f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
18 changes: 9 additions & 9 deletions include/MCU_rev15_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ const unsigned long TELEM_CAN_BAUDRATE = 500000;
// All of these values are the PEDAL min/max
// the sensor min/max that trip implaus are calculated
// in the PedalsSystem constructor
const int ACCEL1_PEDAL_MAX = 3490;
const int ACCEL2_PEDAL_MAX = 189;
const int ACCEL1_PEDAL_MAX = 3476;
const int ACCEL2_PEDAL_MAX = 213;

const int ACCEL1_PEDAL_MIN = 2646;
const int ACCEL2_PEDAL_MIN = 1030;
const int ACCEL1_PEDAL_MIN = 2726;
const int ACCEL2_PEDAL_MIN = 950;

const int BRAKE1_PEDAL_MAX = 2022;
const int BRAKE2_PEDAL_MAX = 1668;
const int BRAKE1_PEDAL_MAX = 1796;
const int BRAKE2_PEDAL_MAX = 1867;

const int BRAKE1_PEDAL_MIN = 1192;
const int BRAKE2_PEDAL_MIN = 2476;
const int BRAKE1_PEDAL_MIN = 1149;
const int BRAKE2_PEDAL_MIN = 2517;

const int ACCEL1_PEDAL_OOR_MIN = 90;
const int ACCEL2_PEDAL_OOR_MIN = 90;
Expand All @@ -76,7 +76,7 @@ const int BRAKE2_PEDAL_OOR_MIN = 90;
const int BRAKE1_PEDAL_OOR_MAX = 4000;
const int BRAKE2_PEDAL_OOR_MAX = 4000;

const float DEFAULT_PEDAL_DEADZONE = 0.05f;
const float DEFAULT_PEDAL_DEADZONE = 0.08f;
const float DEFAULT_PEDAL_IMPLAUSIBILITY_MARGIN = 0.12f;

const float APPS_ACTIVATION_PERCENTAGE = 0.1f;
Expand Down
3 changes: 3 additions & 0 deletions lib/interfaces/src/DrivebrainETHInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ hytech_msgs_MCUOutputData DrivebrainETHInterface::make_db_msg(const SharedCarSta
out.brake_percent = shared_state.pedals_data.regenPercent;

out.has_rpm_data = true;

out.rpm_data.FL = shared_state.drivetrain_data.measuredSpeeds[0];
out.rpm_data.FR = shared_state.drivetrain_data.measuredSpeeds[1];
out.rpm_data.RL = shared_state.drivetrain_data.measuredSpeeds[2];
out.rpm_data.RR = shared_state.drivetrain_data.measuredSpeeds[3];

out.steering_angle_deg = shared_state.steering_data.angle;
out.MCU_recv_millis = _latest_data.last_receive_time_millis;
out.load_cell_data = {shared_state.raw_loadcell_data.raw_load_cell_data.FL,
Expand All @@ -22,6 +24,7 @@ hytech_msgs_MCUOutputData DrivebrainETHInterface::make_db_msg(const SharedCarSta
out.has_load_cell_data = true;

out.timing_failure_active = shared_state.drivebrain_timing_failure;
out.round_trip_time_millis = shared_state.systick.millis - _latest_data.DB_prev_MCU_recv_millis;
return out;
}

Expand Down
1 change: 1 addition & 0 deletions lib/shared_data/include/DrivebrainData.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct DrivebrainData_s
int64_t last_receive_time_millis = -1;
/// @brief the latest MCU last_receive_time_millis that the drivebrain received
int64_t DB_prev_MCU_recv_millis = -1;
int32_t round_trip_time_millis = -1;
veh_vec<float> torque_limits_nm;
veh_vec<float> speed_setpoints_rpm;
};
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lib_deps_shared =
git+ssh://[email protected]/hytech-racing/CASE_lib.git#v49
https://github.com/hytech-racing/shared_firmware_types.git#feb3b83
https://github.com/hytech-racing/shared_firmware_systems.git#af96a63
https://github.com/hytech-racing/HT_proto/releases/download/2024-10-20T18_54_37/hytech_msgs_pb_lib.tar.gz
https://github.com/hytech-racing/HT_proto/releases/download/2024-11-08T01_13_42/hytech_msgs_pb_lib.tar.gz

[env:test_env]
platform = native
Expand Down

0 comments on commit d33d69f

Please sign in to comment.