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

Implementation of LoopClosure that detects when the robot returns near the origin and re‑observes any of the first X cones from the map. More...

#include <lap_counter.hpp>

Inheritance diagram for LapCounter:
Inheritance graph
Collaboration diagram for LapCounter:
Collaboration graph

Public Member Functions

 LapCounter (double threshold_dist, int first_x_cones, int border_width, int minimum_confidence)
 
Result detect (const Eigen::Vector3d &current_pose, const Eigen::VectorXd &map_cones, const Eigen::VectorXi &associations, const Eigen::VectorXd &observations) const override
 Detects loop closure when returning to origin and seeing initial cones.
 
- Public Member Functions inherited from LoopClosure
virtual ~LoopClosure ()=default
 

Private Attributes

double threshold_dist_
 
int first_x_cones_
 
int border_width_
 
int minimum_confidence_
 
bool searching_ {false}
 

Detailed Description

Implementation of LoopClosure that detects when the robot returns near the origin and re‑observes any of the first X cones from the map.

Definition at line 9 of file lap_counter.hpp.

Constructor & Destructor Documentation

◆ LapCounter()

LapCounter::LapCounter ( double  threshold_dist,
int  first_x_cones,
int  border_width,
int  minimum_confidence 
)
Parameters
threshold_distdistance (m) around origin to trigger closure
first_x_conesconsider a loop if you see any of these first X cones
border_widthdistance to givve to start searching for loop closure again
minimum_confidenceminimum number of observations to confirm loop closure

Definition at line 5 of file lap_counter.cpp.

Member Function Documentation

◆ detect()

LoopClosure::Result LapCounter::detect ( const Eigen::Vector3d &  current_pose,
const Eigen::VectorXd &  map_cones,
const Eigen::VectorXi &  associations,
const Eigen::VectorXd &  observations 
) const
overridevirtual

Detects loop closure when returning to origin and seeing initial cones.

Parameters
current_poseyour latest pose in world frame
map_conesfull map of cones (in insertion order)
associationsone entry per observation: >=3 → matched map_cones[(j-3)/2] -1 → new landmark, -2 → no match
observationsraw observations (unused in this implementation)
Returns
{true,0.0} once you re‑see any of map_cones[0..X-1]

Implements LoopClosure.

Definition at line 13 of file lap_counter.cpp.

Member Data Documentation

◆ border_width_

int LapCounter::border_width_
private

Definition at line 36 of file lap_counter.hpp.

◆ first_x_cones_

int LapCounter::first_x_cones_
private

Definition at line 35 of file lap_counter.hpp.

◆ minimum_confidence_

int LapCounter::minimum_confidence_
private

Definition at line 37 of file lap_counter.hpp.

◆ searching_

bool LapCounter::searching_ {false}
mutableprivate

Definition at line 38 of file lap_counter.hpp.

◆ threshold_dist_

double LapCounter::threshold_dist_
private

Definition at line 34 of file lap_counter.hpp.


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