Skip to Content
VectorLib

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>

View source

string_to_hex

pub fn string_to_hex(input: &str) -> String

Convert a string to uppercase hex (LemLib's stringToHex, used in log messages).

Parameters

Prop

Type

Returns

String

View source

get_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>

View source

find_closest

pub fn find_closest(pose: Pose, path: &[Pose]) -> usize

Find the index of the path point closest to the robot.

Parameters

Prop

Type

Returns

usize

View source

circle_intersect

pub fn circle_intersect(p1: Pose, p2: Pose, pose: Pose, lookahead_dist: f32) -> f32

Find 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

f32

View source

lookahead_point

pub fn lookahead_point(
    last_lookahead: Pose,
    pose: Pose,
    path: &[Pose],
    closest: usize,
    lookahead_dist: f32,
) -> Pose

Return the lookahead point. Its theta holds the index of the segment it lies on.

Parameters

Prop

Type

Returns

Pose

View source

find_lookahead_curvature

pub fn find_lookahead_curvature(pose: Pose, heading: f32, lookahead: Pose) -> f32

Curvature of the circle through the robot and the lookahead point, tangent to heading.

Parameters

Prop

Type

Returns

f32

View source