A simple autonomous selector written for the vexide platform. It has support
for categories and its usage is very similar to that of autons' SimpleSelect.
Note
The branding of the crate is currently set to our team's branding. Just fork the repo and change it if you would like.
The home page lists all unique categories (implementing the Category trait) and allows the user to select one.
After selecting a category, the user is presented with a list of routes (created with the route! macro) that belong to that category.
Clicking on a route shows a confirmation screen. If confirm is not pressed, the route is still run anyways, but the user is given a chance to cancel.
After route confirmation, a splash screen with the team branding is shown for the duration of the match.
use autons::prelude::*;
use doxa_selector::{route, DoxaSelect};
use vexide::prelude::*;
struct Robot {}
impl Robot {
async fn route(&mut self) { }
}
// Use `SelectCompete` from `autons`
impl SelectCompete for Robot {}
// Implement the `DoxaSelectInterface` trait to provide interfacing
struct DoxaSelectInterfaceImpl { }
impl doxa_selector::DoxaSelectInterface for DoxaSelectInterfaceImpl {
fn calibrating_enable(&self) -> bool {
true
}
fn calibrating_calibrate(&mut self) {
todo!("Perform any calibration steps here.");
}
fn calibrating_calibrating(&self) -> bool {
false
}
fn diagnostics_enable(&self) -> bool {
true
}
fn diagnostics_diagnostics(&self) -> Vec<(String, String)> {
vec![
(
"Battery charge".to_string(),
format!("{:.0}%", vexide::battery::capacity() * 100.0),
),
]
}
}
// Run your program with `SelectCompete::compete`, passing a `DoxaSelect` instance with your routes and the interface implementation.
#[vexide::main]
async fn main(peripherals: Peripherals) {
let robot = Robot {};
robot
.compete(DoxaSelect::new(
peripherals.display,
&[
route!("Category name".to_string(), Robot::route),
],
DoxaSelectInterfaceImpl {},
))
.await;
}


