Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
Colorpoint Class Reference

Path point with two boundary cones, provides cone classification into left/right boundaries. More...

#include <colorpoint.hpp>

Collaboration diagram for Colorpoint:
Collaboration graph

Public Member Functions

 Colorpoint ()=default
 Default constructor.
 
 Colorpoint (const Point &pt, Cone c1, Cone c2)
 Constructs a Colorpoint with a Point and two boundary cones.
 

Static Public Member Functions

static void extract_cones (std::vector< Colorpoint > &colorpoints, std::vector< PathPoint > &yellow_cones, std::vector< PathPoint > &blue_cones)
 Extracts and classifies all cones from a sequence of colorpoints.
 

Public Attributes

Point point
 The path point (midpoint between cones).
 
Cone cone1
 First cone associated with this path point.
 
Cone cone2
 Second cone associated with this path point.
 

Static Private Member Functions

static void color_cones (Colorpoint &colorpoint, const Colorpoint &next_colorpoint, std::vector< PathPoint > &yellow_cones, std::vector< PathPoint > &blue_cones)
 Classifies the cones of a single colorpoint using the direction to the next point.
 
static void color_last_point (std::vector< Colorpoint > &colorpoints, std::vector< PathPoint > &yellow_cones, std::vector< PathPoint > &blue_cones)
 Classifies the cones of the last colorpoint using a shared cone from the previous one.
 
static void add_cones_by_reference (const Cone &reference_cone, Cone &matching_cone, Cone &other_cone, std::vector< PathPoint > &yellow_cones, std::vector< PathPoint > &blue_cones)
 Classifies a cone pair using a reference cone whose color is already known.
 
static void color_pair_of_cones (Cone &yellow_cone, Cone &blue_cone, std::vector< PathPoint > &yellow_cones, std::vector< PathPoint > &blue_cones)
 Assigns colors to a cone pair and appends them to the output vectors.
 

Detailed Description

Path point with two boundary cones, provides cone classification into left/right boundaries.

Definition at line 25 of file colorpoint.hpp.

Constructor & Destructor Documentation

◆ Colorpoint() [1/2]

Colorpoint::Colorpoint ( )
default

Default constructor.

◆ Colorpoint() [2/2]

Colorpoint::Colorpoint ( const Point pt,
Cone  c1,
Cone  c2 
)
inline

Constructs a Colorpoint with a Point and two boundary cones.

Parameters
ptThe Point
c1The first boundary cone.
c2The second boundary cone.

Definition at line 38 of file colorpoint.hpp.

Member Function Documentation

◆ add_cones_by_reference()

void Colorpoint::add_cones_by_reference ( const Cone reference_cone,
Cone matching_cone,
Cone other_cone,
std::vector< PathPoint > &  yellow_cones,
std::vector< PathPoint > &  blue_cones 
)
staticprivate

Classifies a cone pair using a reference cone whose color is already known.

Parameters
reference_coneA cone whose color is already determined, used as the classification anchor.
matching_coneThe cone in the last point that corresponds to the reference cone.
other_coneThe remaining cone in the last point, assigned the opposite color.
yellow_conesOutput vector for the right-side (yellow) cones.
blue_conesOutput vector for the left-side (blue) cones.

Definition at line 46 of file colorpoint.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ color_cones()

void Colorpoint::color_cones ( Colorpoint colorpoint,
const Colorpoint next_colorpoint,
std::vector< PathPoint > &  yellow_cones,
std::vector< PathPoint > &  blue_cones 
)
staticprivate

Classifies the cones of a single colorpoint using the direction to the next point.

Parameters
colorpointThe current colorpoint whose cones are to be classified.
next_colorpointThe following colorpoint, used to determine path direction.
yellow_conesOutput vector for the right-side (yellow) cones.
blue_conesOutput vector for the left-side (blue) cones.

Definition at line 19 of file colorpoint.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ color_last_point()

void Colorpoint::color_last_point ( std::vector< Colorpoint > &  colorpoints,
std::vector< PathPoint > &  yellow_cones,
std::vector< PathPoint > &  blue_cones 
)
staticprivate

Classifies the cones of the last colorpoint using a shared cone from the previous one.

Parameters
colorpointsThe full sequence of colorpoints. Must contain at least 2 elements.
yellow_conesOutput vector for the right-side (yellow) cones.
blue_conesOutput vector for the left-side (blue) cones.

Definition at line 57 of file colorpoint.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ color_pair_of_cones()

void Colorpoint::color_pair_of_cones ( Cone yellow_cone,
Cone blue_cone,
std::vector< PathPoint > &  yellow_cones,
std::vector< PathPoint > &  blue_cones 
)
staticprivate

Assigns colors to a cone pair and appends them to the output vectors.

Parameters
yellow_coneThe cone to be marked as yellow (right boundary).
blue_coneThe cone to be marked as blue (left boundary).
yellow_conesOutput vector for the right-side (yellow) cones.
blue_conesOutput vector for the left-side (blue) cones.

Definition at line 78 of file colorpoint.cpp.

Here is the caller graph for this function:

◆ extract_cones()

void Colorpoint::extract_cones ( std::vector< Colorpoint > &  colorpoints,
std::vector< PathPoint > &  yellow_cones,
std::vector< PathPoint > &  blue_cones 
)
static

Extracts and classifies all cones from a sequence of colorpoints.

This method processes a vector of colorpoints representing the racing path and classifies each cone as either left (blue) or right (yellow) based on the path direction using cross product calculations.

Parameters
colorpointsVector of colorpoints defining the path.
yellow_conesOutput vector for right-side (yellow) cones.
blue_conesOutput vector for left-side (blue) cones.

Definition at line 3 of file colorpoint.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cone1

Cone Colorpoint::cone1

First cone associated with this path point.

Definition at line 56 of file colorpoint.hpp.

◆ cone2

Cone Colorpoint::cone2

Second cone associated with this path point.

Definition at line 57 of file colorpoint.hpp.

◆ point

Point Colorpoint::point

The path point (midpoint between cones).

Definition at line 55 of file colorpoint.hpp.


The documentation for this class was generated from the following files: