Skip to content

Commit

Permalink
🐛Fixed unit conversion for exit conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
ssejrog authored Jun 2, 2024
1 parent 95b5329 commit d844c96
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/EZ-Template/PID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ exit_output PID::exit_condition(bool print) {

// If the robot is close to the target, start a timer. If the robot doesn't get closer within
// a certain amount of time, exit and continue. This does not run while small_timeout is running
if (exit.big_error != 0 && exit.big_exit_time != 0) { // Check if this condition is enabled
else if (exit.big_error != 0 && exit.big_exit_time != 0) { // Check if this condition is enabled
if (abs(error) < exit.big_error) {
i += util::DELAY_TIME;
if (i > exit.big_exit_time) {
Expand Down
24 changes: 12 additions & 12 deletions src/EZ-Template/drive/exit_conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ void Drive::pid_drive_exit_condition_set(okapi::QTime p_small_exit_time, okapi::
// Convert okapi units to doubles
double se = p_small_error.convert(okapi::inch);
double be = p_big_error.convert(okapi::inch);
double set = p_small_exit_time.convert(okapi::millisecond);
double bet = p_big_exit_time.convert(okapi::millisecond);
double vet = p_velocity_exit_time.convert(okapi::millisecond);
double mAt = p_mA_timeout.convert(okapi::millisecond);
int set = p_small_exit_time.convert(okapi::millisecond);
int bet = p_big_exit_time.convert(okapi::millisecond);
int vet = p_velocity_exit_time.convert(okapi::millisecond);
int mAt = p_mA_timeout.convert(okapi::millisecond);

pid_drive_exit_condition_set(set, se, bet, be, vet, mAt);
}
Expand All @@ -34,10 +34,10 @@ void Drive::pid_turn_exit_condition_set(okapi::QTime p_small_exit_time, okapi::Q
// Convert okapi units to doubles
double se = p_small_error.convert(okapi::degree);
double be = p_big_error.convert(okapi::degree);
double set = p_small_exit_time.convert(okapi::millisecond);
double bet = p_big_exit_time.convert(okapi::millisecond);
double vet = p_velocity_exit_time.convert(okapi::millisecond);
double mAt = p_mA_timeout.convert(okapi::millisecond);
int set = p_small_exit_time.convert(okapi::millisecond);
int bet = p_big_exit_time.convert(okapi::millisecond);
int vet = p_velocity_exit_time.convert(okapi::millisecond);
int mAt = p_mA_timeout.convert(okapi::millisecond);

pid_turn_exit_condition_set(set, se, bet, be, vet, mAt);
}
Expand All @@ -50,10 +50,10 @@ void Drive::pid_swing_exit_condition_set(okapi::QTime p_small_exit_time, okapi::
// Convert okapi units to doubles
double se = p_small_error.convert(okapi::degree);
double be = p_big_error.convert(okapi::degree);
double set = p_small_exit_time.convert(okapi::millisecond);
double bet = p_big_exit_time.convert(okapi::millisecond);
double vet = p_velocity_exit_time.convert(okapi::millisecond);
double mAt = p_mA_timeout.convert(okapi::millisecond);
int set = p_small_exit_time.convert(okapi::millisecond);
int bet = p_big_exit_time.convert(okapi::millisecond);
int vet = p_velocity_exit_time.convert(okapi::millisecond);
int mAt = p_mA_timeout.convert(okapi::millisecond);

pid_swing_exit_condition_set(set, se, bet, be, vet, mAt);
}
Expand Down

0 comments on commit d844c96

Please sign in to comment.