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

#include <competitionLogic.hpp>

Collaboration diagram for CompetitionLogic:
Collaboration graph

Classes

struct  Penalty
 

Public Types

enum  PENALTY_TYPE { DOO , OC , USS }
 

Public Member Functions

 CompetitionLogic (std::shared_ptr< Logger > logger, Track &track, MainConfig config)
 
bool evaluateOffCourse (Track &track, double time, Eigen::Vector3d &position, Eigen::Vector3d &orientation)
 
void evaluateConeHit (Track &track, double time, Eigen::Vector3d &position, Eigen::Vector3d &orientation)
 
int timeKeepingStatus (Eigen::Vector3d lm1, Eigen::Vector3d lm2, Eigen::Vector3d &position, Eigen::Vector3d &orientation)
 
void evaluateTimeKeepings (Track &track, Eigen::Vector3d &position, Eigen::Vector3d &orientation, double time)
 
bool checkFinishConditionsMet (double time)
 
bool checkUSS (Track track, double time, Eigen::Vector3d position)
 
bool checkDNF (Track track, double time, Eigen::Vector3d position)
 
bool performAllChecks (Track &track, double time, Eigen::Vector3d &position, Eigen::Vector3d &orientation)
 
void setFinish (bool val)
 
void fillReport (Report &report, double time)
 

Private Member Functions

bool pointInTriangle (Eigen::Vector2d a, Eigen::Vector2d b, Eigen::Vector2d c, Eigen::Vector2d point)
 
std::vector< bool > pointsInTrackConnected (Track &track, std::vector< Eigen::Vector2d > points)
 
bool pointInPolygon (std::vector< Eigen::Vector2d > polyPoints, Eigen::Vector2d point)
 
std::pair< bool, bool > rayIntersectLineSegment (Eigen::Vector2d a, Eigen::Vector2d b, Eigen::Vector2d rayOrigin, Eigen::Vector2d rayDirection)
 
double cross2d (Eigen::Vector2d a, Eigen::Vector2d b)
 
std::vector< bool > pointsInTrackNotConnected (Track &track, std::vector< Eigen::Vector2d > points)
 
bool carConePolyIntersect (std::vector< Eigen::Vector2d > carPoly, std::vector< Eigen::Vector2d > conePoly)
 
double determinantLinePoint (Eigen::Vector2d a, Eigen::Vector2d b, Eigen::Vector2d c)
 
bool inLineSegement (Eigen::Vector2d a, Eigen::Vector2d b, Eigen::Vector2d position)
 
void evaluateTimeKeepingGateTrigger (Track track, double time, int index)
 
std::string discipline2str (Discipline d)
 
std::string penalty2str (PENALTY_TYPE p)
 
bool checkTimeout (double time)
 

Private Attributes

std::vector< int > timeKeepingStatuses
 
std::vector< int > timeKeepingFirstTriggerStatuses
 
std::vector< std::vector< double > > triggerTimes
 
bool started
 
double startedTime
 
int lapCount
 
double lastTriggerTime
 
std::vector< double > lapTimes
 
std::vector< double > currentSectorTimes
 
std::vector< std::vector< double > > sectorTimes
 
Discipline discipline
 
double finishConditionsMetFirstTime
 
bool finishConditionsMet
 
bool alreadyOC
 
double Off_Course_Start
 
bool isDNF
 
std::string dnf_reason = ""
 
std::vector< Penaltypenalties
 
bool ussTriggered
 
bool finishSignal
 
double timeout_start
 
double timeout_acceleration
 
double timeout_autocross
 
double timeout_skidpad
 
double timeout_trackdrive_first
 
double timeout_trackdrive_total
 
bool properTrack
 

Detailed Description

Definition at line 9 of file competitionLogic.hpp.

Member Enumeration Documentation

◆ PENALTY_TYPE

Enumerator
DOO 
OC 
USS 

Definition at line 12 of file competitionLogic.hpp.

Constructor & Destructor Documentation

◆ CompetitionLogic()

CompetitionLogic::CompetitionLogic ( std::shared_ptr< Logger logger,
Track track,
MainConfig  config 
)

Definition at line 3 of file competitionLogic.cpp.

Member Function Documentation

◆ carConePolyIntersect()

bool CompetitionLogic::carConePolyIntersect ( std::vector< Eigen::Vector2d >  carPoly,
std::vector< Eigen::Vector2d >  conePoly 
)
private

Definition at line 346 of file competitionLogic.cpp.

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

◆ checkDNF()

bool CompetitionLogic::checkDNF ( Track  track,
double  time,
Eigen::Vector3d  position 
)

Definition at line 632 of file competitionLogic.cpp.

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

◆ checkFinishConditionsMet()

bool CompetitionLogic::checkFinishConditionsMet ( double  time)

Definition at line 532 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ checkTimeout()

bool CompetitionLogic::checkTimeout ( double  time)
private

Definition at line 680 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ checkUSS()

bool CompetitionLogic::checkUSS ( Track  track,
double  time,
Eigen::Vector3d  position 
)

Definition at line 604 of file competitionLogic.cpp.

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

◆ cross2d()

double CompetitionLogic::cross2d ( Eigen::Vector2d  a,
Eigen::Vector2d  b 
)
private

Definition at line 193 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ determinantLinePoint()

double CompetitionLogic::determinantLinePoint ( Eigen::Vector2d  a,
Eigen::Vector2d  b,
Eigen::Vector2d  c 
)
private

Definition at line 435 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ discipline2str()

std::string CompetitionLogic::discipline2str ( Discipline  d)
private

Definition at line 759 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ evaluateConeHit()

void CompetitionLogic::evaluateConeHit ( Track track,
double  time,
Eigen::Vector3d &  position,
Eigen::Vector3d &  orientation 
)

Definition at line 363 of file competitionLogic.cpp.

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

◆ evaluateOffCourse()

bool CompetitionLogic::evaluateOffCourse ( Track track,
double  time,
Eigen::Vector3d &  position,
Eigen::Vector3d &  orientation 
)

Definition at line 297 of file competitionLogic.cpp.

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

◆ evaluateTimeKeepingGateTrigger()

void CompetitionLogic::evaluateTimeKeepingGateTrigger ( Track  track,
double  time,
int  index 
)
private

Definition at line 468 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ evaluateTimeKeepings()

void CompetitionLogic::evaluateTimeKeepings ( Track track,
Eigen::Vector3d &  position,
Eigen::Vector3d &  orientation,
double  time 
)

Definition at line 508 of file competitionLogic.cpp.

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

◆ fillReport()

void CompetitionLogic::fillReport ( Report report,
double  time 
)

Definition at line 799 of file competitionLogic.cpp.

Here is the call graph for this function:

◆ inLineSegement()

bool CompetitionLogic::inLineSegement ( Eigen::Vector2d  a,
Eigen::Vector2d  b,
Eigen::Vector2d  position 
)
private

Definition at line 441 of file competitionLogic.cpp.

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

◆ penalty2str()

std::string CompetitionLogic::penalty2str ( PENALTY_TYPE  p)
private

Definition at line 781 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ performAllChecks()

bool CompetitionLogic::performAllChecks ( Track track,
double  time,
Eigen::Vector3d &  position,
Eigen::Vector3d &  orientation 
)

Definition at line 734 of file competitionLogic.cpp.

Here is the call graph for this function:

◆ pointInPolygon()

bool CompetitionLogic::pointInPolygon ( std::vector< Eigen::Vector2d >  polyPoints,
Eigen::Vector2d  point 
)
private

Definition at line 235 of file competitionLogic.cpp.

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

◆ pointInTriangle()

bool CompetitionLogic::pointInTriangle ( Eigen::Vector2d  a,
Eigen::Vector2d  b,
Eigen::Vector2d  c,
Eigen::Vector2d  point 
)
private

Definition at line 42 of file competitionLogic.cpp.

Here is the caller graph for this function:

◆ pointsInTrackConnected()

std::vector< bool > CompetitionLogic::pointsInTrackConnected ( Track track,
std::vector< Eigen::Vector2d >  points 
)
private

Definition at line 53 of file competitionLogic.cpp.

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

◆ pointsInTrackNotConnected()

std::vector< bool > CompetitionLogic::pointsInTrackNotConnected ( Track track,
std::vector< Eigen::Vector2d >  points 
)
private

Definition at line 275 of file competitionLogic.cpp.

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

◆ rayIntersectLineSegment()

std::pair< bool, bool > CompetitionLogic::rayIntersectLineSegment ( Eigen::Vector2d  a,
Eigen::Vector2d  b,
Eigen::Vector2d  rayOrigin,
Eigen::Vector2d  rayDirection 
)
private

Definition at line 195 of file competitionLogic.cpp.

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

◆ setFinish()

void CompetitionLogic::setFinish ( bool  val)

Definition at line 753 of file competitionLogic.cpp.

◆ timeKeepingStatus()

int CompetitionLogic::timeKeepingStatus ( Eigen::Vector3d  lm1,
Eigen::Vector3d  lm2,
Eigen::Vector3d &  position,
Eigen::Vector3d &  orientation 
)

Definition at line 455 of file competitionLogic.cpp.

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

Member Data Documentation

◆ alreadyOC

bool CompetitionLogic::alreadyOC
private

Definition at line 97 of file competitionLogic.hpp.

◆ currentSectorTimes

std::vector<double> CompetitionLogic::currentSectorTimes
private

Definition at line 92 of file competitionLogic.hpp.

◆ discipline

Discipline CompetitionLogic::discipline
private

Definition at line 94 of file competitionLogic.hpp.

◆ dnf_reason

std::string CompetitionLogic::dnf_reason = ""
private

Definition at line 100 of file competitionLogic.hpp.

◆ finishConditionsMet

bool CompetitionLogic::finishConditionsMet
private

Definition at line 96 of file competitionLogic.hpp.

◆ finishConditionsMetFirstTime

double CompetitionLogic::finishConditionsMetFirstTime
private

Definition at line 95 of file competitionLogic.hpp.

◆ finishSignal

bool CompetitionLogic::finishSignal
private

Definition at line 103 of file competitionLogic.hpp.

◆ isDNF

bool CompetitionLogic::isDNF
private

Definition at line 99 of file competitionLogic.hpp.

◆ lapCount

int CompetitionLogic::lapCount
private

Definition at line 87 of file competitionLogic.hpp.

◆ lapTimes

std::vector<double> CompetitionLogic::lapTimes
private

Definition at line 91 of file competitionLogic.hpp.

◆ lastTriggerTime

double CompetitionLogic::lastTriggerTime
private

Definition at line 89 of file competitionLogic.hpp.

◆ Off_Course_Start

double CompetitionLogic::Off_Course_Start
private

Definition at line 98 of file competitionLogic.hpp.

◆ penalties

std::vector<Penalty> CompetitionLogic::penalties
private

Definition at line 101 of file competitionLogic.hpp.

◆ properTrack

bool CompetitionLogic::properTrack
private

Definition at line 110 of file competitionLogic.hpp.

◆ sectorTimes

std::vector<std::vector<double> > CompetitionLogic::sectorTimes
private

Definition at line 93 of file competitionLogic.hpp.

◆ started

bool CompetitionLogic::started
private

Definition at line 85 of file competitionLogic.hpp.

◆ startedTime

double CompetitionLogic::startedTime
private

Definition at line 86 of file competitionLogic.hpp.

◆ timeKeepingFirstTriggerStatuses

std::vector<int> CompetitionLogic::timeKeepingFirstTriggerStatuses
private

Definition at line 81 of file competitionLogic.hpp.

◆ timeKeepingStatuses

std::vector<int> CompetitionLogic::timeKeepingStatuses
private

Definition at line 79 of file competitionLogic.hpp.

◆ timeout_acceleration

double CompetitionLogic::timeout_acceleration
private

Definition at line 105 of file competitionLogic.hpp.

◆ timeout_autocross

double CompetitionLogic::timeout_autocross
private

Definition at line 106 of file competitionLogic.hpp.

◆ timeout_skidpad

double CompetitionLogic::timeout_skidpad
private

Definition at line 107 of file competitionLogic.hpp.

◆ timeout_start

double CompetitionLogic::timeout_start
private

Definition at line 104 of file competitionLogic.hpp.

◆ timeout_trackdrive_first

double CompetitionLogic::timeout_trackdrive_first
private

Definition at line 108 of file competitionLogic.hpp.

◆ timeout_trackdrive_total

double CompetitionLogic::timeout_trackdrive_total
private

Definition at line 109 of file competitionLogic.hpp.

◆ triggerTimes

std::vector<std::vector<double> > CompetitionLogic::triggerTimes
private

Definition at line 83 of file competitionLogic.hpp.

◆ ussTriggered

bool CompetitionLogic::ussTriggered
private

Definition at line 102 of file competitionLogic.hpp.


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