Skip to content

Commit

Permalink
Added motor group exit condition wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ssejrog committed Dec 4, 2024
1 parent 3ad0bd5 commit 8312d53
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/EZ-Template/PID.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ class PID {
*/
ez::exit_output exit_condition(std::vector<pros::Motor> sensor, bool print = false);

/**
* Iterative exit condition for PID.
*
* \param sensor
* Pros motor group on your mechanism.
* \param print = false
* if true, prints when complete.
*/
ez::exit_output exit_condition(pros::MotorGroup sensor, bool print = false);

/**
* Sets the name of the PID that prints during exit conditions.
*
Expand Down
8 changes: 8 additions & 0 deletions src/EZ-Template/PID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,12 @@ exit_output PID::exit_condition(std::vector<pros::Motor> sensor, bool print) {
}

return exit_condition(print);
}

exit_output PID::exit_condition(pros::MotorGroup sensor, bool print) {
std::vector<pros::Motor> vector_sensor;
for (i = 0; i < sensor.size(); i++) {
vector_sensor.push_back(pros::Motor(sensor.get_port(i)));
}
return exit_condition(vector_sensor, print);
}

0 comments on commit 8312d53

Please sign in to comment.