Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
colorpoint.hpp
Go to the documentation of this file.
1#ifndef SRC_PLANNING_INCLUDE_PLANNING_COLORPOINT_HPP_
2#define SRC_PLANNING_INCLUDE_PLANNING_COLORPOINT_HPP_
3
4#include <CGAL/Delaunay_triangulation_2.h>
5#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
6
7#include <memory>
8#include <rclcpp/rclcpp.hpp>
9#include <vector>
10
13
14using K = CGAL::Exact_predicates_inexact_constructions_kernel;
15using Point = K::Point_2;
19
26public:
30 Colorpoint() = default;
31
38 Colorpoint(const Point& pt, Cone c1, Cone c2) : point(pt), cone1(c1), cone2(c2) {}
39
51 static void extract_cones(std::vector<Colorpoint>& colorpoints,
52 std::vector<PathPoint>& yellow_cones,
53 std::vector<PathPoint>& blue_cones);
54
58
59private:
68 static void color_cones(Colorpoint& colorpoint, const Colorpoint& next_colorpoint,
69 std::vector<PathPoint>& yellow_cones, std::vector<PathPoint>& blue_cones);
70
78 static void color_last_point(std::vector<Colorpoint>& colorpoints,
79 std::vector<PathPoint>& yellow_cones,
80 std::vector<PathPoint>& blue_cones);
91 static void add_cones_by_reference(const Cone& reference_cone, Cone& matching_cone,
92 Cone& other_cone, std::vector<PathPoint>& yellow_cones,
93 std::vector<PathPoint>& blue_cones);
102 static void color_pair_of_cones(Cone& yellow_cone, Cone& blue_cone,
103 std::vector<PathPoint>& yellow_cones,
104 std::vector<PathPoint>& blue_cones);
105};
106
107#endif // SRC_PLANNING_INCLUDE_PLANNING_COLORPOINt_HPP_
Path point with two boundary cones, provides cone classification into left/right boundaries.
Point point
The path point (midpoint between cones).
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.
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.
Colorpoint(const Point &pt, Cone c1, Cone c2)
Constructs a Colorpoint with a Point and two boundary cones.
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.
Definition colorpoint.cpp:3
Cone cone2
Second cone associated with this path 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.
Cone cone1
First cone associated with this path point.
Colorpoint()=default
Default constructor.
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.
K::Point_2 Point
K::Point_2 Point
Definition marker.hpp:18
CGAL::Exact_predicates_inexact_constructions_kernel K
Definition marker.hpp:17