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

Added pid_wait_until_index_started (#198) #201

Merged
merged 1 commit into from
Nov 29, 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
16 changes: 12 additions & 4 deletions include/EZ-Template/drive/drive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2343,12 +2343,20 @@ class Drive {
void pid_wait_until_index(int index);

/**
* Lock the code in a while loop until this point has been passed.
* Lock the code in a while loop until this point becomes the target
*
* \param target
* {x, y} a pose for the robot to pass through before the while loop is released
* \param index
* index of your input points, 0 is the first point in the index.
*/
void pid_wait_until_point(pose target);
void pid_wait_until_index_started(int index);

/**
* Lock the code in a while loop until this point has been passed.
*
* \param target
* {x, y} a pose for the robot to pass through before the while loop is released
*/
void pid_wait_until_point(pose target);

/**
* Lock the code in a while loop until this point has been passed. Wrapper for pid_wait_until_point
Expand Down
9 changes: 7 additions & 2 deletions src/EZ-Template/drive/exit_conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void Drive::pid_wait_until(pose target) {
}

// wait for pp
void Drive::pid_wait_until_index(int index) {
void Drive::pid_wait_until_index_started(int index) {
// Let the PID run at least 1 iteration
pros::delay(util::DELAY_TIME);

Expand All @@ -418,8 +418,13 @@ void Drive::pid_wait_until_index(int index) {

pros::delay(util::DELAY_TIME);
}
}

pid_wait_until_point(pp_movements[injected_pp_index[index]].target);
void Drive::pid_wait_until_index(int index) {
pid_wait_until_index_started(index);
index += 1;
pose target = pp_movements[injected_pp_index[index]].target;
pid_wait_until_point(target);
}

// Pid wait, but quickly :)
Expand Down