SUMO - Simulation of Urban MObility
MSDevice_SSM.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // An SSM-device logs encounters / conflicts of the carrying vehicle with other surrounding vehicles.
18 // XXX: Preliminary implementation. Use with care. Especially rerouting vehicles could be problematic.
19 /****************************************************************************/
20 #ifndef MSDevice_SSM_h
21 #define MSDevice_SSM_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <queue>
30 #include "MSVehicleDevice.h"
31 #include <utils/common/SUMOTime.h>
33 #include <utils/geom/Position.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class SUMOVehicle;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
54 class MSCrossSection;
55 
56 class MSDevice_SSM : public MSVehicleDevice {
57 
58 private:
60  static std::set<MSDevice_SSM*>* instances;
61 
62 public:
66  // Other vehicle is closer than range, but not on a lane conflicting with the ego's route ahead
68  // Ego and foe vehicles' edges form a part of a consecutive sequence of edges
69  // This type may be specified further by ENCOUNTER_TYPE_FOLLOWING_LEADER or ENCOUNTER_TYPE_FOLLOWING_FOLLOWER
71  // Ego vehicle is on an edge that has a sequence of successors connected to the other vehicle's edge
73  // Other vehicle is on an edge that has a sequence of successors connected to the ego vehicle's current edge
75  // Other vehicle is on an edge that has a sequence of successors connected to the ego vehicle's current edge
77  // Ego and foe share an upcoming edge of their routes while the merging point for the routes is still ahead
78  // This type may be specified further by ENCOUNTER_TYPE_MERGING_LEADER or ENCOUNTER_TYPE_MERGING_FOLLOWER
80  // Other vehicle is on an edge that has a sequence of successors connected to an edge on the ego vehicle's route
81  // and the estimated arrival vehicle at the merge point is earlier for the ego than for the foe
83  // Other vehicle is on an edge that has a sequence of successors connected to an edge on the ego vehicle's route
84  // and the estimated arrival vehicle at the merge point is earlier for the foe than for the ego
86  // Vehicles' bestlanes lead to the same edge but to adjacent lanes
88  // Ego's and foe's routes have crossing edges
89  // This type may be specified further by ENCOUNTER_TYPE_CROSSING_LEADER or ENCOUNTER_TYPE_CROSSING_FOLLOWER
91  // Other vehicle is on an edge that has a sequence of successors leading to an internal edge that crosses the ego vehicle's edge at a junction
92  // and the estimated arrival vehicle at the merge point is earlier for the ego than for the foe
94  // Other vehicle is on an edge that has a sequence of successors leading to an internal edge that crosses the ego vehicle's edge at a junction
95  // and the estimated arrival vehicle at the merge point is earlier for the foe than for the ego
97  // The encounter is a possible crossing conflict, and the ego vehicle has entered the conflict area
99  // The encounter is a possible crossing conflict, and the foe vehicle has entered the conflict area
101  // The encounter has been a possible crossing conflict, but the ego vehicle has left the conflict area
103  // The encounter has been a possible crossing conflict, but the foe vehicle has left the conflict area
105  // The encounter has been a possible crossing conflict, and both vehicles have entered the conflict area (one must have already left, otherwise this must be a collision)
107  // The encounter has been a possible crossing conflict, but both vehicle have left the conflict area
109  // FOLLOWING_PASSED and MERGING_PASSED are reserved to achieve that these encounter types may be tracked longer (see updatePassedEncounter)
110  // The encounter has been a following situation, but is not active any more
112  // The encounter has been a merging situation, but is not active any more
114  // Collision (currently unused, might be differentiated further)
116  };
117 
118 private:
121  class Encounter {
122  private:
125  struct Trajectory {
126  // positions
128  // momentary speeds
130  };
135  double time;
143  double value;
144 
145  ConflictPointInfo(double time, Position x, EncounterType type, double ssmValue) :
146  time(time), pos(x), type(type), value(ssmValue) {};
147  };
148 
149  public:
151  Encounter(const MSVehicle* _ego, const MSVehicle* const _foe, double _begin, double extraTime);
153  ~Encounter();
154 
156  void add(double time, EncounterType type, Position egoX, Position egoV, Position foeX, Position foeV,
157  Position conflictPoint, double egoDistToConflict, double foeDistToConflict, double ttc, double drac, std::pair<double, double> pet);
158 
160  std::size_t size() const {
161  return timeSpan.size();
162  }
163 
165  void resetExtraTime(double value);
167  void countDownExtraTime(double amount);
169  double getRemainingExtraTime() const;
170 
172  struct compare {
173  typedef bool value_type;
174  bool operator()(Encounter* e1, Encounter* e2) {
175  return e1->begin <= e2->begin;
176  };
177  };
178 
179 
180 
181  public:
182  const MSVehicle* ego;
183  const MSVehicle* foe;
184  const std::string egoID;
185  const std::string foeID;
186  double begin, end;
188 
191 
196 
198  std::vector<double> timeSpan;
200  std::vector<int> typeSpan;
206  std::vector<double> egoDistsToConflict;
208  std::vector<double> foeDistsToConflict;
209 
214 
216  std::vector<double> TTCspan;
218  std::vector<double> DRACspan;
219 
220 // /// @brief Cross sections at which a PET shall be calculated for the corresponding vehicle
221 // std::vector<std::pair<std::pair<const MSLane*, double>, double> > egoPETCrossSections;
222 // std::vector<std::pair<std::pair<const MSLane*, double>, double> > foePETCrossSections;
223 
230 
233 
234  private:
236  Encounter(const Encounter&);
238  Encounter& operator=(const Encounter&);
240  };
241 
242 
261  double ttc;
262  double drac;
263  std::pair<double, double> pet;
264  std::pair<const MSLane*, double> egoConflictEntryCrossSection;
265  std::pair<const MSLane*, double> foeConflictEntryCrossSection;
266  };
267 
268 
272  struct FoeInfo {
275  };
276  // TODO: consider introducing a class foeCollector, which holds the foe info content
277  // plus a vehicle container to be used in findSurrounding vehicles.
278  // findSurroundingVehicles() would then deliver a vector of such foeCollectors
279  // (one for each possible egoConflictLane) instead of a map vehicle->foeInfo
280  // This could be helpful to resolve the resolution for several different
281  // projected conflicts with the same foe.
282 
283 
284  typedef std::priority_queue<Encounter*, std::vector<Encounter*>, Encounter::compare> EncounterQueue;
285  typedef std::vector<Encounter*> EncounterVector;
286  typedef std::map<const MSVehicle*, FoeInfo*> FoeInfoMap;
287 public:
288 
292  static void insertOptions(OptionsCont& oc);
293 
294 
305  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
306 
307 
310  static const std::set<MSDevice_SSM*>& getInstances();
311 
317  void updateAndWriteOutput();
318 
319 private:
320  void update();
321  void writeOutConflict(Encounter* e);
322 
324  static void toGeo(Position& x);
326  static void toGeo(PositionVector& x);
327 
328 public:
331  static void cleanup();
332 
333 
334 public:
336  ~MSDevice_SSM();
337 
338 
350  static void findSurroundingVehicles(const MSVehicle& veh, double range, FoeInfoMap& foeCollector);
351 
354  static void getUpstreamVehicles(const MSEdge* edge, double pos, double range, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector, std::set<const MSJunction*>& seenJunctions);
355 
358  static void getVehiclesOnJunction(const MSJunction*, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector);
359 
360 
363 
373  bool notifyMove(SUMOVehicle& veh, double oldPos,
374  double newPos, double newSpeed);
375 
376 
386  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
387 
388 
397  bool notifyLeave(SUMOVehicle& veh, double lastPos,
398  MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
400 
401 
403  const std::string deviceName() const {
404  return "ssm";
405  }
406 
413  void generateOutput() const;
414 
415 
416 
417 private:
429  MSDevice_SSM(SUMOVehicle& holder, const std::string& id, std::string outputFilename, std::map<std::string, double> thresholds,
430  bool trajectories, double range, double extraTime, bool useGeoCoords);
431 
440  void processEncounters(FoeInfoMap& foes, bool forceClose = false);
441 
442 
447 
448 
449 
452  void createEncounters(FoeInfoMap& foes);
453 
454 
459  void computeGlobalMeasures();
460 
463  void resetEncounters();
464 
468  void flushConflicts(bool all = false);
469 
473  void flushGlobalMeasures();
474 
477  void updateEncounter(Encounter* e, FoeInfo* foeInfo);
478 
489 
490 
501  EncounterType classifyEncounter(const FoeInfo* foeInfo, EncounterApproachInfo& eInfo) const;
502 
503 
509  static void determineConflictPoint(EncounterApproachInfo& eInfo);
510 
511 
521  static void estimateConflictTimes(EncounterApproachInfo& eInfo);
522 
523 
531 
532 
541  const MSLane* findFoeConflictLane(const MSVehicle* foe, const MSLane* egoConflictLane, double& distToConflictLane) const;
542 
545  void closeEncounter(Encounter* e);
546 
550 
555  void computeSSMs(EncounterApproachInfo& e) const;
556 
557 
561  void determinePET(EncounterApproachInfo& eInfo) const;
562 
563 
567  void determineTTCandDRAC(EncounterApproachInfo& eInfo) const;
568 
569 
573  double computeTTC(double gap, double followerSpeed, double leaderSpeed) const;
574 
575 
581  static double computeDRAC(double gap, double followerSpeed, double leaderSpeed);
582 
594  static double computeDRAC(const EncounterApproachInfo& eInfo);
595 
603  static std::string makeStringWithNAs(std::vector<double> v, double NA, std::string sep = " ");
604  static std::string makeStringWithNAs(std::vector<double> v, std::vector<double> NAs, std::string sep = " ");
605 
608  static std::string getOutputFilename(const SUMOVehicle& v, std::string deviceID);
609  static double getDetectionRange(const SUMOVehicle& v);
610  static double getExtraTime(const SUMOVehicle& v);
611  static bool useGeoCoords(const SUMOVehicle& v);
612  static bool requestsTrajectories(const SUMOVehicle& v);
613  static bool getMeasuresAndThresholds(const SUMOVehicle& v, std::string deviceID,
614  std::map<std::string, double>& thresholds);
616 
617 private:
622  std::map<std::string, double> myThresholds;
627  double myRange;
629  double myExtraTime;
636 
637 
641  EncounterVector myActiveEncounters;
645  EncounterQueue myPastConflicts;
647 
648 
649 
652  std::vector<double> myGlobalMeasuresTimeSpan;
654  std::vector<double> myBRspan;
656  std::vector<double> mySGAPspan;
658  std::vector<double> myTGAPspan;
661  std::pair<std::pair<double, Position>, double> myMaxBR;
662  std::pair<std::pair<std::pair<double, Position>, double>, std::string> myMinSGAP;
663  std::pair<std::pair<std::pair<double, Position>, double>, std::string> myMinTGAP;
666 
669 
671  static std::set<std::string> createdOutputFiles;
672 
673 
680  SSM_WARN_RANGE = 1 << 3,
682  SSM_WARN_FILE = 1 << 5,
683  SSM_WARN_GEO = 1 << 6
684  };
685 
686 
687 
688 private:
690  MSDevice_SSM(const MSDevice_SSM&);
691 
694 
695 
696 };
697 
698 #endif
699 
700 /****************************************************************************/
701 
bool myUseGeoCoords
Whether to use the original coordinate system for output.
Definition: MSDevice_SSM.h:631
static void determineConflictPoint(EncounterApproachInfo &eInfo)
Calculates the (x,y)-coordinate for the eventually predicted conflict point and stores the result in ...
std::vector< double > myBRspan
All values for brake rate.
Definition: MSDevice_SSM.h:654
std::pair< const MSLane *, double > egoConflictEntryCrossSection
Definition: MSDevice_SSM.h:264
ENCOUNTER_TYPE_MERGING_ADJACENT.
Definition: MSDevice_SSM.h:87
const std::string egoID
Definition: MSDevice_SSM.h:184
static void getVehiclesOnJunction(const MSJunction *, double egoDistToConflictLane, const MSLane *const egoConflictLane, FoeInfoMap &foeCollector)
Collects all vehicles on the junction into foeCollector.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
void createEncounters(FoeInfoMap &foes)
Makes new encounters for all given vehicles (these should be the ones entering the device&#39;s range in ...
static std::set< MSDevice_SSM * > * instances
All currently existing SSM devices.
Definition: MSDevice_SSM.h:60
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called whenever the holder leaves a lane.
ConflictPointInfo minTTC
Definition: MSDevice_SSM.h:226
bool operator()(Encounter *e1, Encounter *e2)
Definition: MSDevice_SSM.h:174
A simple description of a position on a lane (crossing of a lane)
ConflictPointInfo maxDRAC
Definition: MSDevice_SSM.h:227
static void cleanup()
Clean up remaining devices instances.
EncounterType
Different types of encounters corresponding to relative positions of the vehicles. The name describes the type from the ego perspective.
Definition: MSDevice_SSM.h:65
PositionVector conflictPointSpan
Predicted location of the conflict: In case of MERGING and CROSSING: entry point to conflict area for...
Definition: MSDevice_SSM.h:213
void updatePassedEncounter(Encounter *e, FoeInfo *foeInfo, EncounterApproachInfo &eInfo)
Updates an encounter, which was classified as ENCOUNTER_TYPE_NOCONFLICT_AHEAD this may be the case be...
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_SSM-options.
MSVehicle * myHolderMS
Definition: MSDevice_SSM.h:634
double egoConflictEntryTime
Times when the ego vehicle entered/left the conflict area. Currently only applies for crossing situat...
Definition: MSDevice_SSM.h:193
void determinePET(EncounterApproachInfo &eInfo) const
Discriminates between different encounter types and correspondingly determines the PET for those case...
ConflictPointInfo(double time, Position x, EncounterType type, double ssmValue)
Definition: MSDevice_SSM.h:145
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
Definition: MSDevice_SSM.h:56
void determineTTCandDRAC(EncounterApproachInfo &eInfo) const
Discriminates between different encounter types and correspondingly determines TTC and DRAC for those...
std::pair< std::pair< double, Position >, double > myMaxBR
Extremal values for the global measures (as <<<time, Position>, value>, [leaderID]>-pairs) ...
Definition: MSDevice_SSM.h:661
The base class for an intersection.
Definition: MSJunction.h:61
const MSVehicle * foe
Definition: MSDevice_SSM.h:183
EncounterVector myActiveEncounters
Definition: MSDevice_SSM.h:641
Notification
Definition of a vehicle state.
ENCOUNTER_TYPE_FOLLOWING_PASSED.
Definition: MSDevice_SSM.h:111
double computeTTC(double gap, double followerSpeed, double leaderSpeed) const
Computes the time to collision (in seconds) for two vehicles with a given initial gap under the assum...
EncounterType classifyEncounter(const FoeInfo *foeInfo, EncounterApproachInfo &eInfo) const
Classifies the current type of the encounter provided some information on the opponents.
std::vector< double > myGlobalMeasuresTimeSpan
Definition: MSDevice_SSM.h:652
void closeEncounter(Encounter *e)
Finalizes the encounter and calculates SSM values.
static double getDetectionRange(const SUMOVehicle &v)
ENCOUNTER_TYPE_COLLISION.
Definition: MSDevice_SSM.h:115
static void toGeo(Position &x)
convert SUMO-positions to geo coordinates (in place)
std::vector< double > TTCspan
All values for TTC.
Definition: MSDevice_SSM.h:216
ENCOUNTER_TYPE_EGO_ENTERED_CONFLICT_AREA.
Definition: MSDevice_SSM.h:98
Position pos
Predicted location of the conflict: In case of MERGING and CROSSING: entry point to conflict area for...
Definition: MSDevice_SSM.h:139
static void getUpstreamVehicles(const MSEdge *edge, double pos, double range, double egoDistToConflictLane, const MSLane *const egoConflictLane, FoeInfoMap &foeCollector, std::set< const MSJunction *> &seenJunctions)
Collects all vehicles within range &#39;range&#39; upstream of the position &#39;pos&#39; on the edge &#39;edge&#39; into foe...
ENCOUNTER_TYPE_CROSSING.
Definition: MSDevice_SSM.h:90
const std::string foeID
Definition: MSDevice_SSM.h:185
double time
time point of the conflict
Definition: MSDevice_SSM.h:135
void updateEncounter(Encounter *e, FoeInfo *foeInfo)
Updates the encounter (adds a new trajectory point) and deletes the foeInfo.
void generateOutput() const
Finalizes output. Called on vehicle removal.
void resetExtraTime(double value)
resets remainingExtraTime to the given value
MSDevice_SSM(SUMOVehicle &holder, const std::string &id, std::string outputFilename, std::map< std::string, double > thresholds, bool trajectories, double range, double extraTime, bool useGeoCoords)
Constructor.
ENCOUNTER_TYPE_CROSSING_FOLLOWER.
Definition: MSDevice_SSM.h:96
ENCOUNTER_TYPE_BOTH_ENTERED_CONFLICT_AREA.
Definition: MSDevice_SSM.h:106
std::pair< const MSLane *, double > foeConflictEntryCrossSection
Definition: MSDevice_SSM.h:265
std::vector< double > mySGAPspan
All values for space gap.
Definition: MSDevice_SSM.h:656
static bool requestsTrajectories(const SUMOVehicle &v)
Encounter(const MSVehicle *_ego, const MSVehicle *const _foe, double _begin, double extraTime)
Constructor.
ENCOUNTER_TYPE_CROSSING_LEADER.
Definition: MSDevice_SSM.h:93
EncounterType currentType
Definition: MSDevice_SSM.h:187
std::vector< double > DRACspan
All values for DRAC.
Definition: MSDevice_SSM.h:218
ENCOUNTER_TYPE_FOLLOWING_LEADER.
Definition: MSDevice_SSM.h:74
bool myComputeSGAP
Definition: MSDevice_SSM.h:633
A road/street connecting two junctions.
Definition: MSEdge.h:75
ENCOUNTER_TYPE_MERGING_FOLLOWER.
Definition: MSDevice_SSM.h:85
ENCOUNTER_TYPE_MERGING.
Definition: MSDevice_SSM.h:79
std::size_t size() const
Returns the number of trajectory points stored.
Definition: MSDevice_SSM.h:160
static bool getMeasuresAndThresholds(const SUMOVehicle &v, std::string deviceID, std::map< std::string, double > &thresholds)
ENCOUNTER_TYPE_BOTH_LEFT_CONFLICT_AREA.
Definition: MSDevice_SSM.h:108
std::vector< double > myTGAPspan
All values for time gap.
Definition: MSDevice_SSM.h:658
Representation of a vehicle.
Definition: SUMOVehicle.h:60
static double computeDRAC(double gap, double followerSpeed, double leaderSpeed)
Computes the DRAC (deceleration to avoid a collision) for a lead/follow situation as defined...
void processEncounters(FoeInfoMap &foes, bool forceClose=false)
Finds encounters for which the foe vehicle has disappeared from range. remainingExtraTime is decrease...
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A trajectory encloses a series of positions x and speeds v for one vehicle (the times are stored only...
Definition: MSDevice_SSM.h:125
bool myComputeTTC
Flags for switching on / off comutation of different SSMs, derived from myMeasures.
Definition: MSDevice_SSM.h:633
A list of positions.
OutputDevice * myOutputFile
Output device.
Definition: MSDevice_SSM.h:668
ENCOUNTER_TYPE_FOE_LEFT_CONFLICT_AREA.
Definition: MSDevice_SSM.h:104
void resetEncounters()
Closes all current Encounters and moves conflicts to myPastConflicts,.
double getRemainingExtraTime() const
returns the remaining extra time
double myRange
Detection range. For vehicles closer than this distance from the ego vehicle, SSMs are traced...
Definition: MSDevice_SSM.h:627
std::vector< double > egoDistsToConflict
Evolution of the ego vehicle&#39;s distance to the conflict point.
Definition: MSDevice_SSM.h:206
static int issuedParameterWarnFlags
bitset storing info whether warning has already been issued about unset parameter (warn only once!) ...
Definition: MSDevice_SSM.h:675
ENCOUNTER_TYPE_FOLLOWING_FOLLOWER.
Definition: MSDevice_SSM.h:72
ENCOUNTER_TYPE_NOCONFLICT_AHEAD.
Definition: MSDevice_SSM.h:67
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called whenever the holder enteres a lane.
void computeSSMs(EncounterApproachInfo &e) const
Compute current values of the logged SSMs (myMeasures) for the given encounter &#39;e&#39; and update &#39;e&#39; acc...
bool qualifiesAsConflict(Encounter *e)
Tests if the SSM values exceed the threshold for qualification as conflict.
static void checkConflictEntryAndExit(EncounterApproachInfo &eInfo)
Checks whether ego or foe have entered or left the conflict area in the last step and eventually writ...
ENCOUNTER_TYPE_MERGING_LEADER.
Definition: MSDevice_SSM.h:82
std::pair< std::pair< std::pair< double, Position >, double >, std::string > myMinTGAP
Definition: MSDevice_SSM.h:663
ENCOUNTER_TYPE_FOE_ENTERED_CONFLICT_AREA.
Definition: MSDevice_SSM.h:100
void updateAndWriteOutput()
This is called once per time step in MSNet::writeOutput() and collects the surrounding vehicles...
ConflictPointInfo PET
Definition: MSDevice_SSM.h:228
void flushGlobalMeasures()
Write out all non-encounter specific measures as headways and braking rates.
static const std::set< MSDevice_SSM * > & getInstances()
returns all currently existing SSM devices
const MSLane * findFoeConflictLane(const MSVehicle *foe, const MSLane *egoConflictLane, double &distToConflictLane) const
Computes the conflict lane for the foe.
EncounterType type
Type of the conflict.
Definition: MSDevice_SSM.h:141
double myOldestActiveEncounterBegin
begin time of the oldest active encounter
Definition: MSDevice_SSM.h:643
void storeEncountersExceedingMaxLength()
Closes encounters, whose duration exceeds the maximal encounter length. If it is classified as confli...
ENCOUNTER_TYPE_FOLLOWING.
Definition: MSDevice_SSM.h:70
bool mySaveTrajectories
This determines whether the whole trajectories of the vehicles (position, speed, ssms) shall be saved...
Definition: MSDevice_SSM.h:625
static std::string getOutputFilename(const SUMOVehicle &v, std::string deviceID)
const MSVehicle * ego
Definition: MSDevice_SSM.h:182
static double getExtraTime(const SUMOVehicle &v)
void flushConflicts(bool all=false)
Writes out all past conflicts that have begun earlier than the oldest active encounter.
static std::string makeStringWithNAs(std::vector< double > v, double NA, std::string sep=" ")
make a string of a double vector and treat a special value as invalid ("NA")
Compares encounters regarding to their start time.
Definition: MSDevice_SSM.h:172
std::vector< double > foeDistsToConflict
Evolution of the foe vehicle&#39;s distance to the conflict point.
Definition: MSDevice_SSM.h:208
bool closingRequested
this flag is set by updateEncounter() or directly in processEncounters(), where encounters are closed...
Definition: MSDevice_SSM.h:232
bool myComputeDRAC
Definition: MSDevice_SSM.h:633
ENCOUNTER_TYPE_FOLLOWING_PASSED.
Definition: MSDevice_SSM.h:113
std::vector< Encounter * > EncounterVector
Definition: MSDevice_SSM.h:285
static bool useGeoCoords(const SUMOVehicle &v)
void countDownExtraTime(double amount)
decreases myRemaingExtraTime by given amount in seconds
bool myComputeTGAP
Definition: MSDevice_SSM.h:633
double foeConflictEntryTime
Times when the foe vehicle entered/left the conflict area. Currently only applies for crossing situat...
Definition: MSDevice_SSM.h:195
std::map< const MSVehicle *, FoeInfo * > FoeInfoMap
Definition: MSDevice_SSM.h:286
const MSLane * egoConflictLane
Definition: MSDevice_SSM.h:273
Trajectory egoTrajectory
Trajectory of the ego vehicle.
Definition: MSDevice_SSM.h:202
~MSDevice_SSM()
Destructor.
void computeGlobalMeasures()
Stores measures, that are not associated to a specific encounter as headways and brake rates...
Structure to collect some info on the encounter needed during ssm calculation by various functions...
Definition: MSDevice_SSM.h:244
std::vector< double > timeSpan
time points corresponding to the trajectories
Definition: MSDevice_SSM.h:198
A storage for options typed value containers)
Definition: OptionsCont.h:92
ENCOUNTER_TYPE_EGO_LEFT_CONFLICT_AREA.
Definition: MSDevice_SSM.h:102
Abstract in-vehicle device.
std::pair< double, double > pet
Definition: MSDevice_SSM.h:263
std::map< std::string, double > myThresholds
Definition: MSDevice_SSM.h:622
ConflictPointInfo stores some information on a specific conflict point (used to store information on ...
Definition: MSDevice_SSM.h:133
Encounter & operator=(const Encounter &)
Invalidated assignment operator.
std::pair< std::pair< std::pair< double, Position >, double >, std::string > myMinSGAP
Definition: MSDevice_SSM.h:662
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
An encounter is an episode involving two vehicles, which are closer to each other than some specified...
Definition: MSDevice_SSM.h:121
double myExtraTime
Extra time in seconds to be logged after a conflict is over.
Definition: MSDevice_SSM.h:629
std::vector< int > typeSpan
Evolution of the encounter classification (.
Definition: MSDevice_SSM.h:200
double remainingExtraTime
Remaining extra time (decreases after an encounter ended)
Definition: MSDevice_SSM.h:190
ENCOUNTER_TYPE_ON_ADJACENT_LANES.
Definition: MSDevice_SSM.h:76
static void estimateConflictTimes(EncounterApproachInfo &eInfo)
Estimates the time until conflict for the vehicles based on the distance to the conflict entry points...
void writeOutConflict(Encounter *e)
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
static std::set< std::string > createdOutputFiles
remember which files were created already (don&#39;t duplicate xml root-elements)
Definition: MSDevice_SSM.h:671
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
EncounterQueue myPastConflicts
Past encounters that where qualified as conflicts and are not yet flushed to the output file...
Definition: MSDevice_SSM.h:645
double value
value of the corresponding SSM
Definition: MSDevice_SSM.h:143
Trajectory foeTrajectory
Trajectory of the foe vehicle.
Definition: MSDevice_SSM.h:204
static void findSurroundingVehicles(const MSVehicle &veh, double range, FoeInfoMap &foeCollector)
Returns all vehicles, which are within the given range of the given vehicle.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice *> &into)
Build devices for the given vehicle, if needed.
std::priority_queue< Encounter *, std::vector< Encounter * >, Encounter::compare > EncounterQueue
Definition: MSDevice_SSM.h:284
void add(double time, EncounterType type, Position egoX, Position egoV, Position foeX, Position foeV, Position conflictPoint, double egoDistToConflict, double foeDistToConflict, double ttc, double drac, std::pair< double, double > pet)
add a new data point and update encounter type
const std::string deviceName() const
return the name for this type of device
Definition: MSDevice_SSM.h:403