|
Formula Student Autonomous Systems
The code for the main driverless system
|
Generates midpoints between cones using Delaunay triangulation. More...
#include <midpoint_generator.hpp>

Public Member Functions | |
| MidpointGenerator ()=default | |
| Default constructor. | |
| MidpointGenerator (const MidpointGeneratorConfig &config) | |
| Constructs a new MidpointGenerator with a specific configuration. | |
| std::vector< std::shared_ptr< Midpoint > > & | generate_midpoints (const std::vector< Cone > &cone_array, bool rebuild_all_midpoints) |
| Generates midpoints from a set of cones. | |
| const std::vector< std::pair< Point, Point > > & | get_triangulations () const |
| Returns the current set of Delaunay edges used for visualization. | |
| void | set_vehicle_pose (const Pose &vehicle_pose) |
| Updates the vehicle pose for dynamic filtering. | |
Private Member Functions | |
| void | filter_cones (const std::vector< Cone > &cone_array, std::vector< std::shared_ptr< Cone > > &filtered_cones, bool rebuild_all_midpoints) |
| Filters input cones based on proximity to the vehicle pose. | |
| std::shared_ptr< Midpoint > | process_triangle_edge (const Vertex_handle &va, const Vertex_handle &vb, std::vector< std::shared_ptr< Cone > > &filtered_cones, std::map< std::pair< int, int >, std::shared_ptr< Midpoint > > &segment_to_midpoint) |
| Processes a single edge of a Delaunay triangle and creates its midpoint if valid. | |
| void | connect_triangle_midpoints (const std::array< std::shared_ptr< Midpoint >, 3 > &triangle_midpoints) |
| Connects midpoints that belong to the same Delaunay triangle. | |
| int | find_cone (std::vector< std::shared_ptr< Cone > > &cones, double x, double y) |
| Finds a cone in a vector based on its position coordinates. | |
Private Attributes | |
| std::vector< std::pair< Point, Point > > | triangulations_ |
| Pose | vehicle_pose_ |
| std::vector< std::shared_ptr< Midpoint > > | midpoints_ |
| MidpointGeneratorConfig | config_ |
Generates midpoints between cones using Delaunay triangulation.
The algorithm performs the following main steps:
Definition at line 34 of file midpoint_generator.hpp.
|
default |
Default constructor.
|
inlineexplicit |
Constructs a new MidpointGenerator with a specific configuration.
| config | Configuration object defining thresholds and filtering behavior. |
Definition at line 46 of file midpoint_generator.hpp.
|
private |
Connects midpoints that belong to the same Delaunay triangle.
| triangle_midpoints | Array of up to three midpoints from one triangle. |
Definition at line 110 of file midpoint_generator.cpp.

|
private |
Filters input cones based on proximity to the vehicle pose.
| cone_array | Input array of detected cones. |
| filtered_cones | Output vector containing cones after filtering. |
| rebuild_all_midpoints | Whether to reset filtering and include all cones. |
Definition at line 44 of file midpoint_generator.cpp.

|
private |
Finds a cone in a vector based on its position coordinates.
| cones | Reference to a vector of shared pointers to Cone objects. |
| x | The x-coordinate of the cone to find. |
| y | The y-coordinate of the cone to find. |
Definition at line 133 of file midpoint_generator.cpp.

| std::vector< std::shared_ptr< Midpoint > > & MidpointGenerator::generate_midpoints | ( | const std::vector< Cone > & | cone_array, |
| bool | rebuild_all_midpoints | ||
| ) |
Generates midpoints from a set of cones.
This method filters cones (if enabled), computes the Delaunay triangulation, and generates valid midpoints between cone pairs that meet distance constraints.
| cone_array | Input vector of cone objects. |
| rebuild_all_midpoints | Whether to use all cones |
Definition at line 3 of file midpoint_generator.cpp.


Returns the current set of Delaunay edges used for visualization.
Definition at line 125 of file midpoint_generator.cpp.

|
private |
Processes a single edge of a Delaunay triangle and creates its midpoint if valid.
This function verifies the corresponding cones for the edge, checks distance constraints, and either creates a new midpoint or reuses an existing one to prevent duplication.
| va | First vertex of the triangle edge. |
| vb | Second vertex of the triangle edge. |
| filtered_cones | Vector of all filtered cones. |
| segment_to_midpoint | Map used to ensure unique midpoint creation per cone pair. |
Definition at line 69 of file midpoint_generator.cpp.


| void MidpointGenerator::set_vehicle_pose | ( | const Pose & | vehicle_pose | ) |
Updates the vehicle pose for dynamic filtering.
This pose is used to center the sliding window for filtering relevant cones.
| vehicle_pose | The current vehicle pose. |
Definition at line 129 of file midpoint_generator.cpp.

|
private |
Definition at line 87 of file midpoint_generator.hpp.
|
private |
Definition at line 85 of file midpoint_generator.hpp.
Definition at line 79 of file midpoint_generator.hpp.
|
private |
Definition at line 82 of file midpoint_generator.hpp.