21 #include <adore/fun/nlpqlp_planner/colors.h>
22 #include <adore/fun/nlpqlp_planner/planner_data.h>
44 enum LanePosition {offTheRoad = -1, hardShoulder=0, outermostDrivingLane = 1, secondLaneFromOutside = 2, thirdLaneFromOutside = 3, fourthLaneFromOutside = 4, fifthLaneFromOutside = 5 };
57 platooningInformation_writer =
FunFactory::get()->getPlatooningStateWriter();
58 this->three_lanes_ = three_lanes_;
59 this->v2xStationID = data.v2xStationID ;
61 possiblePlatooningTau = 5.;
63 communicationDelayThreshold = 0.5;
82 NoCommunicationDelay_p =
false;
87 this->lanePosition = lanePosition;
92 if(preceding.MCM.communicationDelay < communicationDelayThreshold) NoCommunicationDelay_p=
true;
93 if(preceding.MCM.lane_position == lanePosition ) sameLane_p =
true;
100 preceding.inPlatooningRange &&
101 NoCommunicationDelay_p)
104 psm.process_event(
WF2J());
116 preceding.inPlatooningRange &&
117 NoCommunicationDelay_p &&
121 psm.process_event(
J2IP());
130 !NoCommunicationDelay_p)
133 psm.process_event(
J2WF());
134 psm.process_event(
IP2WF());
149 following.MCM.lane_position == lanePosition &&
152 psm.process_event(
WF2IP());
153 psm.process_event(
J2IP());
159 following.MCM.lane_position != lanePosition ||
160 following.MCM.communicationDelay > communicationDelayThreshold)
162 psm.process_event(
J2WF());
163 psm.process_event(
IP2WF());
184 platooningInformation.
setId(v2xStationID);
192 platooningInformation_writer->
write(platooningInformation);
193 if(data.print_strategy) print();
210 std::cout<<
"\n--------------------------------";
212 std::cout<<
"\nEgo is: "<<v2xStationID;
218 std::cout<<
"\nPreceding: "<<preceding.
MCM.
id;
219 printPlatooningState( preceding.PlatooningState );
221 if(preceding.MCM.lane_position== lanePosition) std::cout<<
" SAME LANE";
222 if(preceding.inPlatooningRange) std::cout<<
" IN RANGE";
223 if(preceding.MCM.communicationDelay>communicationDelayThreshold) std::cout<< BOLD(FRED(
" DELAY"));
230 std::cout<<
"\nFollowing: "<<following.
MCM.
id;
231 printPlatooningState( following.PlatooningState );
233 if(following.MCM.lane_position== lanePosition) std::cout<<
" SAME LANE";
234 if(following.inPlatooningRange) std::cout<<
" IN RANGE";
235 if(following.MCM.communicationDelay>communicationDelayThreshold) std::cout<< BOLD(FRED(
" DELAY"));
244 if(ps == 0) std::cout <<
"\t"<< BOLD(FRED(
"NOT ABLE"));
245 if(ps== 1) std::cout <<
"\t"<< BOLD(FYEL(
"WANT TO FORM"));
246 if(ps == 2) std::cout <<
"\t"<< BOLD(FMAG(
"JOINING"));
247 if(ps == 3) std::cout <<
"\t"<< BOLD(FGRN(
"IN PLATOON"));
248 if(ps== 4) std::cout <<
"\t"<< BOLD(FRED(
"LEAVING"));
Definition: localroadmap.h:38
Definition: cooperativeusersprocess.h:27
bool precedingExists()
Definition: cooperativeusersprocess.h:68
CooperativeUser getFollowing()
Definition: cooperativeusersprocess.h:67
bool noVehicleBetweenEgoAndFollowing()
Definition: cooperativeusersprocess.h:81
bool leaderExists()
Definition: cooperativeusersprocess.h:69
double getFollowingTimeHeadway()
Definition: cooperativeusersprocess.h:79
double getPrecedingTimeHeadway()
Definition: cooperativeusersprocess.h:78
bool followingExists()
Definition: cooperativeusersprocess.h:70
CooperativeUser getPreceding()
Definition: cooperativeusersprocess.h:65
bool noVehicleBetweenEgoAndPreceding()
Definition: cooperativeusersprocess.h:80
Utility class to simplify factory access.
Definition: afactory.h:220
Definition: threelaneviewdecoupled.h:32
Utility class to simplify factory access.
Definition: afactory.h:154
static adore::fun::AFactory * get()
Definition: afactory.h:170
Definition: platoonLogic.h:35
platoonLogic(adore::env::ThreeLaneViewDecoupled *three_lanes_, adore::env::CooperativeUsersProcess *CooperativeUsersProcess, Planner_data data)
Definition: platoonLogic.h:54
adore::fun::logic::DistanceStateMachine dsm
Definition: platoonLogic.h:47
LanePosition
Definition: platoonLogic.h:44
adore::mad::AWriter< adore::fun::PlatooningInformation > * platooningInformation_writer
Definition: platoonLogic.h:41
int lanePosition
Definition: platoonLogic.h:49
void printPlatooningState(int ps)
Definition: platoonLogic.h:242
adore::env::CooperativeUsersProcess * CooperativeUsersProcess
Definition: platoonLogic.h:253
int v2xStationID
Definition: platoonLogic.h:48
int update(adore::fun::VehicleMotionState9d &egoStates, int lanePosition=1)
Definition: platoonLogic.h:79
bool sameLane_p
Definition: platoonLogic.h:207
int CAR_FOLLOWING_TACTICS
Definition: platoonLogic.h:38
adore::env::BorderBased::LocalRoadMap roadmap_
Definition: platoonLogic.h:40
~platoonLogic()
Definition: platoonLogic.h:75
double eps
Definition: platoonLogic.h:254
adore::env::ThreeLaneViewDecoupled * three_lanes_
Definition: platoonLogic.h:252
CAR_FOLLOWING_TACTICS
Definition: platoonLogic.h:39
bool NoCommunicationDelay_p
Definition: platoonLogic.h:206
double communicationDelayThreshold
Definition: platoonLogic.h:50
adore::fun::logic::PlatooningStateMachine psm
Definition: platoonLogic.h:46
double possiblePlatooningTau
if the time headway to the preceding vehicle is less than this value we consider it for platooning
Definition: platoonLogic.h:251
adore::fun::PlatooningInformation platooningInformation
Definition: platoonLogic.h:42
Planner_data data
Definition: platoonLogic.h:51
void print()
Definition: platoonLogic.h:208
virtual void write(const T &value)=0
Utility class to simplify factory access.
Definition: afactory.h:87
const double eps
Definition: cubic_piecewise_function.cpp:16
Definition: afactory.h:38
Definition: distanceStateMachine.h:29
@ Joining
Definition: platoonStateMachine.h:42
@ InPlatoon
Definition: platoonStateMachine.h:42
@ NotAble
Definition: platoonStateMachine.h:42
@ Leaving
Definition: platoonStateMachine.h:42
@ WantToForm
Definition: platoonStateMachine.h:42
@ SAE_LEVEL3
Definition: platoonStateMachine.h:43
adoreMatrix< T, N, M > max(adoreMatrix< T, N, M > a, const adoreMatrix< T, N, M > &b)
Definition: adoremath.h:686
Definition: areaofeffectconverter.h:20
int id
Definition: cooperativeusersprediction.h:27
CooperativeUserPrediction MCM
Definition: cooperativeusersprocess.h:33
This struct holds the motion state of the vehicle in 9d.
Definition: vehiclemotionstate9d.h:39
double getvx() const
Get the longitudinal velocity.
Definition: vehiclemotionstate9d.h:78
Definition: distanceStateMachine.h:42
Definition: platoonStateMachine.h:56
Definition: platoonStateMachine.h:49
Definition: platoonStateMachine.h:48
Definition: platoonStateMachine.h:72
double getTimeHeadway()
Definition: platoonStateMachine.h:76
int getPlatooningState()
Definition: platoonStateMachine.h:77
double getInPlatoonTimeHeadway()
Definition: platoonStateMachine.h:78
Definition: platoonStateMachine.h:53
Definition: platoonStateMachine.h:51