Autonomous Selector
initialize()
Initializes the autonomous selector. If an SD card is plugged in, the current page will set to what's on the SD card.
- Prototype
- Example
void initialize() {
ez::as::initialize();
}
void initialize();
limit_switch_lcd_initialize()
Sets external buttons to increase/decrease the current autonomous page.
right_limit
a button to go forward a page
left_limit
a button to go backwards a page
- Prototype
- Example
pros::adi::DigitalIn increase('A');
pros::adi::DigitalIn decrease('B');
void initialize() {
ez::as::initialize();
ez::as::limit_switch_lcd_initialize(&increase, &decrease);
// . . .
}
void limit_switch_lcd_initialize(pros::adi::DigitalIn* right_limit, pros::adi::DigitalIn* left_limit = nullptr);
shutdown()
Wrapper for pros::lcd::shutdown()
found here.
- Prototype
- Example
void initialize() {
ez::as::initialize();
// Do something
ez::as::shutdown();
}
void shutdown();
add_autons();
Adds autonomous routines to the autonomous selector. Uses ez::print_to_screen()
to display to the brain.
autons
accepts an object of a string and a function
- Prototype
- Example
void auto1() {
// Do something
}
void auto2() {
// Do something
}
void auto3() {
// Do something
}
void initialize() {
ez::as::auton_selector.add_autons({
Auton("Autonomous 1\nDoes Something", auto1),
Auton("Autonomous 2\nDoes Something Else", auto2),
Auton("Autonomous 3\nDoes Something More", auto3),
});
}
void add_autons(std::vector<Auton> autons);
print_selected_auton();
Prints the current autonomous mode to the screen.
- Prototype
- Example
void initialize() {
ez::as::auton_selector.print_selected_auton();
}
void print_selected_auton();
page_down()
Decreases the page number. Best used with the lcd callback functions.
- Prototype
- Example
void initialize() {
pros::lcd::register_btn0_cb(ez::as::page_down);
pros::lcd::register_btn2_cb(ez::as::page_up);
}
void page_down();
page_up()
Increases the page number. Best used with the lcd callback functions
- Prototype
- Example
Example
void initialize() {
pros::lcd::register_btn2_cb(ez::as::page_up);
}
void page_down();
void page_up();
call_selected_auton()
Runs the current autonomous that's selected.
- Prototype
- Example
void autonomous() {
chassis.reset_gyro();
chassis.reset_drive_sensor();
chassis.set_drive_brake(MOTOR_BRAKE_HOLD);
ez::as::auton_selector.call_selected_auton();
}
void call_selected_auton();