Skip to content

Commit

Permalink
Merge pull request #210 from EZ-Robotics/feature/motor-group-exiting
Browse files Browse the repository at this point in the history
Added motor group exit condition wrapper
  • Loading branch information
ssejrog authored Dec 4, 2024
2 parents 1de5b28 + 8312d53 commit b00157d
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 b00157d

Please sign in to comment.