Skip to main content

Pure Pursuit

Functions

distance()

Gets the distance betweens between the two points.

double distance(std::vector<double> p1, std::vector<double> p2);

Parameters
p1A vector of length two in the format {Y,X} that contains Robot::y and Robot::x.
p2A vector of length two in the format {Y, X} that contains the Y and X coordinate of the target point.

Returns: Provides the distance between the two points using the standard distance formula


get_intersection()

Calculates the next step of our pure pursuit mvoement given a segment of the waypoint path and our current position

std::vector<double> get_intersection(std::vector<double> start,
std::vector<double> end,
std::vector<double> cur, double radius)

Parameters
startFirst point of waypoint path.
endSecond point of a two-point segment of the waypoint path.
curA vector that contains Robot::y and Robot::x position.
radiusA scalar representing how far our lookahead distance should be- in other words, how early we should start turning in anticipation of a change in direction

Returns: The intersection between a circle centered on our Robot's current position with radius and the line formed between start and end