Brains and Drivers

Description

Collaboration diagram for Brains and Drivers:

Classes

class  chrono::synchrono::SynACCBrain
 Vehicle Brain instance that instructs its vehicle to follow a given curve and stop based on lidar data and traffic light message data. More...
 
class  chrono::synchrono::SynBrain
 Base class for any brain - must Advance the state of physics, Synchronize state with others and Process Messages. More...
 
class  chrono::synchrono::SynCollisionBrain
 Detects when this vehicle is "nearby" other (target_rank) vehicles and calls a user-provided callback function in such a case. More...
 
class  chrono::synchrono::SynEnvironmentBrain
 All logic happens in the EnvironmentAgent class, but we still need an empty concrete class here. More...
 
class  chrono::synchrono::SynQueryEnvBrain
 Vehicle Brain instance that instructs its vehicle to follow a given curve and stop based on zombie agent and traffic light message data. More...
 
class  chrono::synchrono::SynVehicleBrain
 Enforces having a ChDriver, and getting inputs from said driver to pass to a ChVehicle. More...
 

Functions

double chrono::synchrono::DistanceToLine (ChVector<> p, ChVector<> l1, ChVector<> l2)
 
bool chrono::synchrono::IsInsideBox (ChVector<> pos, ChVector<> front, ChVector<> back, double width)
 front, back and width define a box, check if pos is inside that box More...
 
bool chrono::synchrono::IsInsideQuad (ChVector<> pos, ChVector<> sp1, ChVector<> sp2, ChVector<> cp3, ChVector<> cp4)
 Checks if pos is inside the (assumed convex) quadrilateral defined by vectors for each vertex.
 
void chrono::synchrono::Barycentric (ChVector<> p, ChVector<> a, ChVector<> b, ChVector<> c, float &u, float &v, float &w)
 Compute barycentric coordinates (u, v, w) for point p with respect to triangle (a, b, c)
 
void chrono::synchrono::UpdateLaneInfoFromMAP (SynMessage *synmsg, ChVector<> veh_pos, const int &rank, bool &inside_box, int &current_lane, int &current_approach, int &current_intersection, double &dist)
 update inside_box, dist and current_* variables based on info from a MAP message More...
 
void chrono::synchrono::UpdateInsideBoxFromApproachMessage (SynApproachMessage &app_msg, ChVector<> veh_pos, int &current_lane, bool &inside_box, double &dist)
 update current_lane, inside_box and dist based on info from an Approach Message
 
void chrono::synchrono::UpdateInsideBoxFromMessage (SynMessage *synmsg, ChVector<> veh_pos, int &current_lane, bool &inside_box, double &dist)
 calls UpdateInsideBoxFromApproachMessage
 
LaneColor chrono::synchrono::GetLaneColorFromMessage (SynMessage *synmsg, const int intersection, const int approach, const int lane)
 Given an intersection, approach and lane, parse a SPAT message (synmsg) and return the lane color.
 

Function Documentation

◆ DistanceToLine()

double chrono::synchrono::DistanceToLine ( ChVector<>  p,
ChVector<>  l1,
ChVector<>  l2 
)
Parameters
ppoint that the distance is computed from
l1one end of the line
l2other end of the line

◆ IsInsideBox()

bool chrono::synchrono::IsInsideBox ( ChVector<>  pos,
ChVector<>  front,
ChVector<>  back,
double  width 
)

front, back and width define a box, check if pos is inside that box

Parameters
posvector position to be checked against the box
frontvector position, line between this and back divides the box into two rectangles
backvector defining the back center of the box rectangle
widthi.e. box_area = width * (front - back).length

◆ UpdateLaneInfoFromMAP()

void chrono::synchrono::UpdateLaneInfoFromMAP ( SynMessage synmsg,
ChVector<>  veh_pos,
const int &  rank,
bool &  inside_box,
int &  current_lane,
int &  current_approach,
int &  current_intersection,
double &  dist 
)

update inside_box, dist and current_* variables based on info from a MAP message

Parameters
synmsgmust be castable to type SynMAPMessage
veh_poscurrent GREF vector location of the vehicle
rankof the vehicle we are checking
[in,out]inside_boxwhether the vehicle was in the stopping box for this particular lane
[in,out]current_laneif we're in a box, which lane that belonged to
[in,out]current_approachif we're in a box, which approach that belonged to
[in,out]current_intersectionif we're in a box, which intersection that belonged to
[in,out]distif vehicle is in box, how far is the vehicle from the box's stopping point (front of the box)