Project Chrono: Controllers and Drivers

Functions
Controllers and Drivers
SYNCHRONO module

## Description

Collaboration diagram for Controllers and Drivers:

## Functions
double | chrono::synchrono::DistanceToLine (ChVector3d p, ChVector3d l1, ChVector3d l2)
bool | chrono::synchrono::IsInsideBox (ChVector3d pos, ChVector3d front, ChVector3d back, double width)
| front, back and width define a box, check if pos is inside that box
bool | chrono::synchrono::IsInsideQuad (ChVector3d pos, ChVector3d sp1, ChVector3d sp2, ChVector3d cp3, ChVector3d cp4)
| Checks if pos is inside the (assumed convex) quadrilateral defined by vectors for each vertex.
void | chrono::synchrono::Barycentric (ChVector3d p, ChVector3d a, ChVector3d b, ChVector3d c, double &u, double &v, double &w)
| Compute barycentric coordinates (u, v, w) for point p with respect to triangle (a, b, c).
void | chrono::synchrono::UpdateLaneInfoFromMAP (std::shared_ptr< SynMessage > synmsg, ChVector3d 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
void | chrono::synchrono::UpdateInsideBoxFromApproachMessage (std::shared_ptr< SynApproachMessage > app_msg, ChVector3d 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 (std::shared_ptr< SynMessage > synmsg, ChVector3d veh_pos, int &current_lane, bool &inside_box, double &dist)
| calls UpdateInsideBoxFromApproachMessage
LaneColor | chrono::synchrono::GetLaneColorFromMessage (std::shared_ptr< 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 | ( | ChVector3d | p,
|  | ChVector3d | l1,
|  | ChVector3d | l2 )

Parameters

  p | point that the distance is computed from
  l1 | one end of the line
  l2 | other end of the line

## ◆ IsInsideBox()

bool chrono::synchrono::IsInsideBox | ( | ChVector3d | pos,
|  | ChVector3d | front,
|  | ChVector3d | back,
|  | double | width )

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

Parameters

  pos | vector position to be checked against the box
  front | vector position, line between this and back divides the box into two rectangles
  back | vector defining the back center of the box rectangle
  width | i.e. box_area = width * (front - back).length

## ◆ UpdateLaneInfoFromMAP()

void chrono::synchrono::UpdateLaneInfoFromMAP | ( | std::shared_ptr< SynMessage > | synmsg,
|  | ChVector3d | 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

  | synmsg | must be castable to type SynMAPMessage
  | veh_pos | current GREF vector location of the vehicle
  | rank | of the vehicle we are checking
  [in,out] | inside_box | whether the vehicle was in the stopping box for this particular lane
  [in,out] | current_lane | if we're in a box, which lane that belonged to
  [in,out] | current_approach | if we're in a box, which approach that belonged to
  [in,out] | current_intersection | if we're in a box, which intersection that belonged to
  [in,out] | dist | if vehicle is in box, how far is the vehicle from the box's stopping point (front of the box)