pursuit
Public functions and their Rust signatures.
read_element
pub fn read_element(input: &str, delimiter: &str) -> Vec<String>Return the elements in a line, separated by a delimiter (LemLib's readElement).
Parameters
Prop
Type
Returns
Vec<String>string_to_hex
pub fn string_to_hex(input: &str) -> StringConvert a string to uppercase hex (LemLib's stringToHex, used in log messages).
Parameters
Prop
Type
Returns
Stringget_data
pub fn get_data(path: &Asset) -> Vec<Pose>Read the points of a path file (LemLib's getData).
Each line is x, y, velocity. Reading stops at a line equal to endData.
Parameters
Prop
Type
Returns
Vec<Pose>find_closest
pub fn find_closest(pose: Pose, path: &[Pose]) -> usizeFind the index of the path point closest to the robot.
Parameters
Prop
Type
Returns
usizecircle_intersect
pub fn circle_intersect(p1: Pose, p2: Pose, pose: Pose, lookahead_dist: f32) -> f32Find where the segment p1 → p2 intersects a circle of radius lookahead_dist around
pose. Returns how far along the segment (0-1) the intersection is, or -1 if none.
Parameters
Prop
Type
Returns
f32lookahead_point
pub fn lookahead_point(
last_lookahead: Pose,
pose: Pose,
path: &[Pose],
closest: usize,
lookahead_dist: f32,
) -> PoseReturn the lookahead point. Its theta holds the index of the segment it lies on.
Parameters
Prop
Type
Returns
Posefind_lookahead_curvature
pub fn find_lookahead_curvature(pose: Pose, heading: f32, lookahead: Pose) -> f32Curvature of the circle through the robot and the lookahead point, tangent to heading.
Parameters
Prop
Type
Returns
f32