PID Tuner
Setter Functions
pid_tuner_enable()
Enables PID Tuner.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
// Enable PID Tuner
chassis.pid_tuner_enable();
while (true) {
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_enable();
pid_tuner_disable()
Disables PID Tuner.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
// Enable PID Tuner
chassis.pid_tuner_enable();
while (true) {
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
// Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_disable();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_disable();
pid_tuner_toggle()
Toggles PID tuner between enabled and disabled.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_toggle();
pid_tuner_iterate()
Iterates through controller inputs to modify PID constants.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_iterate();
pid_tuner_print_brain_set()
Toggle for printing the display of the PID Tuner to the brain. It prints to the brain by default, and this only does something while the PID Tuner is enabled.
input true prints to brain, false doesn't
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_print_brain_set(true); // Does nothing until the PID Tuner is enabled
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_print_brain_set(bool input);
pid_tuner_print_terminal_set()
Toggle for printing the display of the PID Tuner to the terminal.
input true prints to terminal, false doesn't
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_print_terminal_set(true);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_print_terminal_set(bool input);
pid_tuner_increment_p_set()
Sets the value that PID Tuner increments P.
p p will increase by this
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_p_set(0.25);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_increment_p_set(double p);
pid_tuner_increment_i_set()
Sets the value that PID Tuner increments I.
i i will increase by this
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_i_set(0.25);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_increment_i_set(double i);
pid_tuner_increment_d_set()
Sets the value that PID Tuner increments D.
d d will increase by this
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_d_set(1.0);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_increment_d_set(double d);
pid_tuner_increment_start_i_set()
Sets the value that PID Tuner increments Start I.
start_i start i will increase by this
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_start_i_set(5.0);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
void pid_tuner_increment_start_i_set(double start_i);
pid_tuner_add()
Adds a PID to the PID Tuner. This adds to both the default tuner and the full tuner.
new_pid_and_name {"name", &pid.constants}
- Prototype
- Example
ez::PID lift_pid{20.0, 0.0, 100.0};
void initialize() {
chassis.pid_tuner_add({"Lift", &lift_pid.constants});
}
void pid_tuner_add(const_and_name new_pid_and_name);
pid_tuner_button_increment_set()
Sets the button to increment the focused PID constant.
increase a pros controller button
- Prototype
- Example
void initialize() {
chassis.pid_tuner_button_increment_set(DIGITAL_UP);
}
void pid_tuner_button_increment_set(pros::controller_digital_e_t increase);
pid_tuner_button_decrement_set()
Sets the button to decrement the focused PID constant.
decrease a pros controller button
- Prototype
- Example
void initialize() {
chassis.pid_tuner_button_decrement_set(DIGITAL_DOWN);
}
void pid_tuner_button_decrement_set(pros::controller_digital_e_t decrease);
pid_tuner_button_up_set()
Sets the button to move up between the PID constants.
pageUp a pros controller button
- Prototype
- Example
void initialize() {
chassis.pid_tuner_button_up_set(DIGITAL_Y);
}
void pid_tuner_button_up_set(pros::controller_digital_e_t pageUp);
pid_tuner_button_down_set()
Sets the button to move down between the PID constants.
pageDown a pros controller button
- Prototype
- Example
void initialize() {
chassis.pid_tuner_button_down_set(DIGITAL_A);
}
void pid_tuner_button_down_set(pros::controller_digital_e_t pageDown);
pid_tuner_button_left_set()
Sets the button to go left in the PID Tuner.
pageLeft a pros controller button
- Prototype
- Example
void initialize() {
chassis.pid_tuner_button_left_set(DIGITAL_LEFT);
}
void pid_tuner_button_left_set(pros::controller_digital_e_t pageLeft);
pid_tuner_button_right_set()
Sets the button to go right in the PID Tuner.
pageRight a pros controller button
- Prototype
- Example
void initialize() {
chassis.pid_tuner_button_right_set(DIGITAL_RIGHT);
}
void pid_tuner_button_right_set(pros::controller_digital_e_t pageRight);
Getter Functions
pid_tuner_enabled()
Checks if PID Tuner is enabled.
True is enabled, false is disabled.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X)) {
if (chassis.pid_tuner_enabled())
chassis.pid_tuner_disable();
else
chassis.pid_tuner_enable();
}
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
bool pid_tuner_enabled();
pid_tuner_print_terminal_enabled()
Returns true if printing to terminal is enabled.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_print_terminal_set(true);
printf("Printing to Terminal? %i\n", chassis.pid_tuner_print_terminal_enabled()); // Prints 1
chassis.pid_tuner_print_terminal_set(false);
printf("Printing to Terminal? %i\n", chassis.pid_tuner_print_terminal_enabled()); // Prints 0
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
bool pid_tuner_print_terminal_enabled();
pid_tuner_print_brain_enabled()
Returns true if printing to brain is enabled.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_enable(); // pid_tuner_print_brain_set() only does something while the PID Tuner is enabled
chassis.pid_tuner_print_brain_set(false);
printf("Printing to Brain? %i\n", chassis.pid_tuner_print_brain_enabled()); // Prints 0
chassis.pid_tuner_print_brain_set(true);
printf("Printing to Brain? %i\n", chassis.pid_tuner_print_brain_enabled()); // Prints 1
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
bool pid_tuner_print_brain_enabled();
pid_tuner_increment_p_get()
Returns the value that PID Tuner increments P.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_p_set(0.25);
printf("%f\n", chassis.pid_tuner_increment_p_get());
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
double pid_tuner_increment_p_get();
pid_tuner_increment_i_get()
Returns the value that PID Tuner increments I.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_i_set(0.25);
printf("%f\n", chassis.pid_tuner_increment_i_get());
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
double pid_tuner_increment_i_get();
pid_tuner_increment_d_get()
Returns the value that PID Tuner increments D.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_d_set(1.0);
printf("%f\n", chassis.pid_tuner_increment_d_get());
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
double pid_tuner_increment_d_get();
pid_tuner_increment_start_i_get()
Returns the value that PID Tuner increments Start I.
- Prototype
- Example
void opcontrol() {
// This is preference to what you like to drive on
chassis.drive_brake_set(MOTOR_BRAKE_COAST);
chassis.pid_tuner_increment_start_i_set(5.0);
printf("%f\n", chassis.pid_tuner_increment_start_i_get());
while (true) {
// PID Tuner
// After you find values that you're happy with, you'll have to set them in auton.cpp
if (!pros::competition::is_connected()) {
// Enable / Disable PID Tuner
if (master.get_digital_new_press(DIGITAL_X))
chassis.pid_tuner_toggle();
// Trigger the selected autonomous routine
if (master.get_digital_new_press(DIGITAL_B))
autonomous();
chassis.pid_tuner_iterate(); // Allow PID Tuner to iterate
}
chassis.opcontrol_tank(); // Tank control
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
}
}
double pid_tuner_increment_start_i_get();
pid_tuner_button_increment_get()
Returns the pros button that increments the focused PID constant.
- Prototype
- Example
chassis.pid_tuner_button_increment_set(DIGITAL_UP);
printf("%i\n", chassis.pid_tuner_button_increment_get()); // Prints DIGITAL_UP
pros::controller_digital_e_t pid_tuner_button_increment_get();
pid_tuner_button_decrement_get()
Returns the pros button that decrements the focused PID constant.
- Prototype
- Example
chassis.pid_tuner_button_decrement_set(DIGITAL_DOWN);
printf("%i\n", chassis.pid_tuner_button_decrement_get()); // Prints DIGITAL_DOWN
pros::controller_digital_e_t pid_tuner_button_decrement_get();
pid_tuner_button_up_get()
Returns the pros button that moves up between the PID constants.
- Prototype
- Example
chassis.pid_tuner_button_up_set(DIGITAL_Y);
printf("%i\n", chassis.pid_tuner_button_up_get()); // Prints DIGITAL_Y
pros::controller_digital_e_t pid_tuner_button_up_get();
pid_tuner_button_down_get()
Returns the pros button that moves down between the PID constants.
- Prototype
- Example
chassis.pid_tuner_button_down_set(DIGITAL_A);
printf("%i\n", chassis.pid_tuner_button_down_get()); // Prints DIGITAL_A
pros::controller_digital_e_t pid_tuner_button_down_get();
pid_tuner_button_left_get()
Returns the pros button that goes left in the PID Tuner.
- Prototype
- Example
chassis.pid_tuner_button_left_set(DIGITAL_LEFT);
printf("%i\n", chassis.pid_tuner_button_left_get()); // Prints DIGITAL_LEFT
pros::controller_digital_e_t pid_tuner_button_left_get();
pid_tuner_button_right_get()
Returns the pros button that goes right in the PID Tuner.
- Prototype
- Example
chassis.pid_tuner_button_right_set(DIGITAL_RIGHT);
printf("%i\n", chassis.pid_tuner_button_right_get()); // Prints DIGITAL_RIGHT
pros::controller_digital_e_t pid_tuner_button_right_get();