Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Exit conditions now work (#101) #103

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading