Skip to content

Commit

Permalink
Added steer dependent torque delta constraint to TCS
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke-kC committed May 10, 2024
1 parent f2c263a commit a5be8d7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/systems/include/CASESystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ struct CASEConfiguration
float maxNormalLoadBrakeScalingFront;
float tcs_saturation_front;
float tcs_saturation_rear;
float TCSGenLeftRightDiffLowerBound;
float TCSGenLeftRightDiffUpperBound;
float TCSWheelSteerLowerBound;
float TCSWheelSteerUpperBound;

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

in.TCS_Saturation_Rear = config_.tcs_saturation_rear;

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

in.TCSGenLeftRightDiffUpperBound = config_.TCSGenLeftRightDiffUpperBound;

in.TCSWheelSteerLowerBound = config_.TCSWheelSteerLowerBound;

in.TCSWheelSteerUpperBound = config_.TCSWheelSteerUpperBound;

if ((vn_active_start_time_ == 0) && (vn_status >= 2))
{
vn_active_start_time_ = tick.millis;
}
Expand Down Expand Up @@ -217,6 +225,7 @@ DrivetrainCommand_s CASESystem<message_queue>::evaluate(
enqueue_matlab_msg(msg_queue_, res.controllerBus_controller_tcs_co);
enqueue_matlab_msg(msg_queue_, res.controllerBus_controller_yaw_pi);
enqueue_matlab_msg(msg_queue_, res.controllerBus_controller_tcs_sa);
enqueue_matlab_msg(msg_queue_, res.controllerBus_controller_tcs_di);

last_lowest_priority_controller_send_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/87/can_lib.tar.gz
git+ssh://git@github.com/hytech-racing/CASE_lib.git#v46
https://github.com/hytech-racing/HT_CAN/releases/download/89/can_lib.tar.gz
git+ssh://git@github.com/hytech-racing/CASE_lib.git#v47

[env:test_can_on_teensy]
lib_ignore =
Expand Down
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ CASEConfiguration case_config = {
.maxNormalLoadBrakeScalingFront = 1.25,
.tcs_saturation_front = 20,
.tcs_saturation_rear = 20,

.TCSGenLeftRightDiffLowerBound = 2, // N-m
.TCSGenLeftRightDiffUpperBound = 20, // N-m
.TCSWheelSteerLowerBound = 2, // Deg
.TCSWheelSteerUpperBound = 25, // Deg

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

0 comments on commit a5be8d7

Please sign in to comment.