Skip to content

Commit

Permalink
Added TCS saturation limit for front and rear axles
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke-kC committed May 9, 2024
1 parent a7913ab commit 32c0265
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib/systems/include/CASESystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ struct CASEConfiguration
float tcs_pid_lower_rpm_rear;
float tcs_pid_upper_rpm_rear;
float maxNormalLoadBrakeScalingFront;
float tcs_saturation_front;
float tcs_saturation_rear;

float max_rpm;
float max_regen_torque;
float max_torque;
Expand Down
6 changes: 5 additions & 1 deletion lib/systems/include/CASESystem.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ DrivetrainCommand_s CASESystem<message_queue>::evaluate(

in.maxNormalLoadBrakeScalingFront = config_.maxNormalLoadBrakeScalingFront;

if ((vn_active_start_time_ == 0) && (vn_status >= 2))
in.TCS_Saturation_Front = config_.tcs_saturation_front;

in.TCS_Saturation_Rear = config_.tcs_saturation_rear;

if ((vn_active_start_time_ == 0) && (vn_status >= 2))
{
vn_active_start_time_ = tick.millis;
}
Expand Down
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ lib_deps =
https://github.com/RCMast3r/spi_libs
https://github.com/tonton81/FlexCAN_T4
https://github.com/RCMast3r/hytech_can#testing_new_inv_ids
https://github.com/hytech-racing/HT_CAN/releases/download/86/can_lib.tar.gz
git+ssh://git@github.com/hytech-racing/CASE_lib.git#v45
https://github.com/hytech-racing/HT_CAN/releases/download/87/can_lib.tar.gz
git+ssh://git@github.com/hytech-racing/CASE_lib.git#v46

[env:test_can_on_teensy]
lib_ignore =
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ CASEConfiguration case_config = {
.tcs_pid_lower_rpm_rear = 0.0, // RPM
.tcs_pid_upper_rpm_rear = 5000.0, // RPM
.maxNormalLoadBrakeScalingFront = 1.25,
.tcs_saturation_front = 20,
.tcs_saturation_rear = 20,


// Following used for calculate_torque_request in CASESystem.tpp
.max_rpm = 20000,
Expand Down

0 comments on commit 32c0265

Please sign in to comment.