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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // An SSM-device logs encounters / conflicts of the carrying vehicle with other surrounding vehicles.
20 // XXX: Preliminary implementation. Use with care. Especially rerouting vehicles could be problematic.
21 /****************************************************************************/
22 #ifndef MSDevice_SSM_h
23 #define MSDevice_SSM_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <queue>
36 #include "MSDevice.h"
37 #include <utils/common/SUMOTime.h>
39 #include <utils/geom/Position.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class SUMOVehicle;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
60 class MSCrossSection;
61 
62 class MSDevice_SSM : public MSDevice {
63 
64 private:
66  static std::set<MSDevice*>* instances;
67 
68 public:
72  // Other vehicle is closer than range, but not on a lane conflicting with the ego's route ahead
74  // Ego and foe vehicles' edges form a part of a consecutive sequence of edges
75  // This type may be specified further by ENCOUNTER_TYPE_FOLLOWING_LEADER or ENCOUNTER_TYPE_FOLLOWING_FOLLOWER
77  // Ego vehicle is on an edge that has a sequence of successors connected to the other vehicle's edge
79  // Other vehicle is on an edge that has a sequence of successors connected to the ego vehicle's current edge
81  // Other vehicle is on an edge that has a sequence of successors connected to the ego vehicle's current edge
83  // Ego and foe share an upcoming edge of their routes while the merging point for the routes is still ahead
84  // This type may be specified further by ENCOUNTER_TYPE_MERGING_LEADER or ENCOUNTER_TYPE_MERGING_FOLLOWER
86  // Other vehicle is on an edge that has a sequence of successors connected to an edge on the ego vehicle's route
87  // and the estimated arrival vehicle at the merge point is earlier for the ego than for the foe
89  // Other vehicle is on an edge that has a sequence of successors connected to an edge on the ego vehicle's route
90  // and the estimated arrival vehicle at the merge point is earlier for the foe than for the ego
92  // Vehicles' bestlanes lead to the same edge but to adjacent lanes
94  // Ego's and foe's routes have crossing edges
95  // This type may be specified further by ENCOUNTER_TYPE_CROSSING_LEADER or ENCOUNTER_TYPE_CROSSING_FOLLOWER
97  // 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
98  // and the estimated arrival vehicle at the merge point is earlier for the ego than for the foe
100  // 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
101  // and the estimated arrival vehicle at the merge point is earlier for the foe than for the ego
103  // The encounter is a possible crossing conflict, and the ego vehicle has entered the conflict area
105  // The encounter is a possible crossing conflict, and the foe vehicle has entered the conflict area
107  // The encounter has been a possible crossing conflict, but the ego vehicle has left the conflict area
109  // The encounter has been a possible crossing conflict, but the foe vehicle has left the conflict area
111  // 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)
113  // The encounter has been a possible crossing conflict, but both vehicle have left the conflict area
115  // FOLLOWING_PASSED and MERGING_PASSED are reserved to achieve that these encounter types may be tracked longer (see updatePassedEncounter)
116  // The encounter has been a following situation, but is not active any more
118  // The encounter has been a merging situation, but is not active any more
120  // Collision (currently unused, might be differentiated further)
122  };
123 
124 private:
127  class Encounter {
128  private:
131  struct Trajectory {
132  // positions
134  // momentary speeds
136  };
141  double time;
149  double value;
150 
151  ConflictPointInfo(double time, Position x, EncounterType type, double ssmValue) :
152  time(time), pos(x), type(type), value(ssmValue) {};
153  };
154 
155  public:
157  Encounter(const MSVehicle* _ego, const MSVehicle* const _foe, double _begin, double extraTime);
159  ~Encounter();
160 
162  void add(double time, EncounterType type, Position egoX, Position egoV, Position foeX, Position foeV,
163  Position conflictPoint, double egoDistToConflict, double foeDistToConflict, double ttc, double drac, std::pair<double, double> pet);
164 
166  std::size_t size() const {
167  return timeSpan.size();
168  }
169 
171  void resetExtraTime(double value);
173  void countDownExtraTime(double amount);
175  double getRemainingExtraTime() const;
176 
178  struct compare {
179  typedef bool value_type;
180  bool operator()(Encounter* e1, Encounter* e2) {
181  return e1->begin <= e2->begin;
182  };
183  };
184 
185 
186 
187  public:
188  const MSVehicle* ego;
189  const MSVehicle* foe;
190  const std::string egoID;
191  const std::string foeID;
192  double begin, end;
194 
197 
202 
204  std::vector<double> timeSpan;
206  std::vector<int> typeSpan;
212  std::vector<double> egoDistsToConflict;
214  std::vector<double> foeDistsToConflict;
215 
220 
222  std::vector<double> TTCspan;
224  std::vector<double> DRACspan;
225 
226 // /// @brief Cross sections at which a PET shall be calculated for the corresponding vehicle
227 // std::vector<std::pair<std::pair<const MSLane*, double>, double> > egoPETCrossSections;
228 // std::vector<std::pair<std::pair<const MSLane*, double>, double> > foePETCrossSections;
229 
236 
239 
240  private:
242  Encounter(const Encounter&);
244  Encounter& operator=(const Encounter&);
246  };
247 
248 
267  double ttc;
268  double drac;
269  std::pair<double, double> pet;
270  std::pair<const MSLane*, double> egoConflictEntryCrossSection;
271  std::pair<const MSLane*, double> foeConflictEntryCrossSection;
272  };
273 
274 
278  struct FoeInfo {
281  };
282  // TODO: consider introducing a class foeCollector, which holds the foe info content
283  // plus a vehicle container to be used in findSurrounding vehicles.
284  // findSurroundingVehicles() would then deliver a vector of such foeCollectors
285  // (one for each possible egoConflictLane) instead of a map vehicle->foeInfo
286  // This could be helpful to resolve the resolution for several different
287  // projected conflicts with the same foe.
288 
289 
290  typedef std::priority_queue<Encounter*, std::vector<Encounter*>, Encounter::compare> EncounterQueue;
291  typedef std::vector<Encounter*> EncounterVector;
292  typedef std::map<const MSVehicle*, FoeInfo*> FoeInfoMap;
293 public:
294 
298  static void insertOptions(OptionsCont& oc);
299 
300 
311  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into);
312 
313 
316  static const std::set<MSDevice*>& getInstances();
317 
323  void updateAndWriteOutput();
324 
325 private:
326  void update();
327  void writeOutConflict(Encounter* e);
328 
330  static void toGeo(Position& x);
332  static void toGeo(PositionVector& x);
333 
334 public:
337  static void cleanup();
338 
339 
340 public:
342  ~MSDevice_SSM();
343 
344 
356  static void findSurroundingVehicles(const MSVehicle& veh, double range, FoeInfoMap& foeCollector);
357 
360  static void getUpstreamVehicles(const MSEdge* edge, double pos, double range, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector, std::set<const MSJunction*> seenJunctions);
361 
364  static void getVehiclesOnJunction(const MSJunction*, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector);
365 
366 
369 
379  bool notifyMove(SUMOVehicle& veh, double oldPos,
380  double newPos, double newSpeed);
381 
382 
392  bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
393 
394 
403  bool notifyLeave(SUMOVehicle& veh, double lastPos,
404  MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
406 
407 
409  const std::string deviceName() const {
410  return "ssm";
411  }
412 
419  void generateOutput() const;
420 
421 
422 
423 private:
435  MSDevice_SSM(SUMOVehicle& holder, const std::string& id, std::string outputFilename, std::map<std::string, double> thresholds,
436  bool trajectories, double range, double extraTime, bool useGeoCoords);
437 
446  void processEncounters(FoeInfoMap& foes, bool forceClose = false);
447 
448 
453 
454 
455 
458  void createEncounters(FoeInfoMap& foes);
459 
460 
463  void resetEncounters();
464 
468  void flushConflicts(bool all = false);
469 
472  void updateEncounter(Encounter* e, FoeInfo* foeInfo);
473 
484 
485 
496  EncounterType classifyEncounter(const FoeInfo* foeInfo, EncounterApproachInfo& eInfo) const;
497 
498 
504  static void determineConflictPoint(EncounterApproachInfo& eInfo);
505 
506 
516  static void estimateConflictTimes(EncounterApproachInfo& eInfo);
517 
518 
526 
527 
536  const MSLane* findFoeConflictLane(const MSVehicle* foe, const MSLane* egoConflictLane, double& distToConflictLane) const;
537 
540  void closeEncounter(Encounter* e);
541 
545 
550  void computeSSMs(EncounterApproachInfo& e) const;
551 
552 
556  void determinePET(EncounterApproachInfo& eInfo) const;
557 
558 
562  void determineTTCandDRAC(EncounterApproachInfo& eInfo) const;
563 
564 
568  double computeTTC(double gap, double followerSpeed, double leaderSpeed) const;
569 
570 
576  static double computeDRAC(double gap, double followerSpeed, double leaderSpeed);
577 
589  static double computeDRAC(const EncounterApproachInfo& eInfo);
590 
598  static std::string makeStringWithNAs(std::vector<double> v, double NA, std::string sep = " ");
599  static std::string makeStringWithNAs(std::vector<double> v, std::vector<double> NAs, std::string sep = " ");
600 
603  static std::string getOutputFilename(const SUMOVehicle& v, std::string deviceID);
604  static double getDetectionRange(const SUMOVehicle& v);
605  static double getExtraTime(const SUMOVehicle& v);
606  static bool useGeoCoords(const SUMOVehicle& v);
607  static bool requestsTrajectories(const SUMOVehicle& v);
608  static bool getMeasuresAndThresholds(const SUMOVehicle& v, std::string deviceID,
609  std::map<std::string, double>& thresholds);
611 
612 private:
617  std::map<std::string, double> myThresholds;
622  double myRange;
624  double myExtraTime;
631 
632 
636  EncounterVector myActiveEncounters;
640  EncounterQueue myPastConflicts;
642 
645 
647  static std::set<std::string> createdOutputFiles;
648 
649 private:
651  MSDevice_SSM(const MSDevice_SSM&);
652 
655 
656 
657 };
658 
659 #endif
660 
661 /****************************************************************************/
662 
bool myUseGeoCoords
Whether to use the original coordinate system for output.
Definition: MSDevice_SSM.h:626
static void determineConflictPoint(EncounterApproachInfo &eInfo)
Calculates the (x,y)-coordinate for the eventually predicted conflict point and stores the result in ...
std::pair< const MSLane *, double > egoConflictEntryCrossSection
Definition: MSDevice_SSM.h:270
ENCOUNTER_TYPE_MERGING_ADJACENT.
Definition: MSDevice_SSM.h:93
const std::string egoID
Definition: MSDevice_SSM.h:190
static const std::set< MSDevice * > & getInstances()
returns all currently existing SSM devices
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:83
void createEncounters(FoeInfoMap &foes)
Makes new encounters for all given vehicles (these should be the ones entering the device&#39;s range in ...
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:232
bool operator()(Encounter *e1, Encounter *e2)
Definition: MSDevice_SSM.h:180
A simple description of a position on a lane (crossing of a lane)
ConflictPointInfo maxDRAC
Definition: MSDevice_SSM.h:233
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:71
PositionVector conflictPointSpan
Predicted location of the conflict: In case of MERGING and CROSSING: entry point to conflict area for...
Definition: MSDevice_SSM.h:219
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:629
double egoConflictEntryTime
Times when the ego vehicle entered/left the conflict area. Currently only applies for crossing situat...
Definition: MSDevice_SSM.h:199
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:151
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
Definition: MSDevice_SSM.h:62
void determineTTCandDRAC(EncounterApproachInfo &eInfo) const
Discriminates between different encounter types and correspondingly determines TTC and DRAC for those...
The base class for an intersection.
Definition: MSJunction.h:64
const MSVehicle * foe
Definition: MSDevice_SSM.h:189
EncounterVector myActiveEncounters
Definition: MSDevice_SSM.h:636
Notification
Definition of a vehicle state.
ENCOUNTER_TYPE_FOLLOWING_PASSED.
Definition: MSDevice_SSM.h:117
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.
void closeEncounter(Encounter *e)
Finalizes the encounter and calculates SSM values.
static double getDetectionRange(const SUMOVehicle &v)
ENCOUNTER_TYPE_COLLISION.
Definition: MSDevice_SSM.h:121
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:222
ENCOUNTER_TYPE_EGO_ENTERED_CONFLICT_AREA.
Definition: MSDevice_SSM.h:104
Position pos
Predicted location of the conflict: In case of MERGING and CROSSING: entry point to conflict area for...
Definition: MSDevice_SSM.h:145
ENCOUNTER_TYPE_CROSSING.
Definition: MSDevice_SSM.h:96
const std::string foeID
Definition: MSDevice_SSM.h:191
double time
time point of the conflict
Definition: MSDevice_SSM.h:141
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:102
ENCOUNTER_TYPE_BOTH_ENTERED_CONFLICT_AREA.
Definition: MSDevice_SSM.h:112
std::pair< const MSLane *, double > foeConflictEntryCrossSection
Definition: MSDevice_SSM.h:271
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:99
EncounterType currentType
Definition: MSDevice_SSM.h:193
std::vector< double > DRACspan
All values for DRAC.
Definition: MSDevice_SSM.h:224
ENCOUNTER_TYPE_FOLLOWING_LEADER.
Definition: MSDevice_SSM.h:80
A road/street connecting two junctions.
Definition: MSEdge.h:80
ENCOUNTER_TYPE_MERGING_FOLLOWER.
Definition: MSDevice_SSM.h:91
ENCOUNTER_TYPE_MERGING.
Definition: MSDevice_SSM.h:85
std::size_t size() const
Returns the number of trajectory points stored.
Definition: MSDevice_SSM.h:166
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:114
Representation of a vehicle.
Definition: SUMOVehicle.h:66
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:45
A trajectory encloses a series of positions x and speeds v for one vehicle (the times are stored only...
Definition: MSDevice_SSM.h:131
bool myComputeTTC
Flags for switching on / off comutation of different SSMs, derived from myMeasures.
Definition: MSDevice_SSM.h:628
A list of positions.
OutputDevice * myOutputFile
Output device.
Definition: MSDevice_SSM.h:644
ENCOUNTER_TYPE_FOE_LEFT_CONFLICT_AREA.
Definition: MSDevice_SSM.h:110
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:622
std::vector< double > egoDistsToConflict
Evolution of the ego vehicle&#39;s distance to the conflict point.
Definition: MSDevice_SSM.h:212
ENCOUNTER_TYPE_FOLLOWING_FOLLOWER.
Definition: MSDevice_SSM.h:78
ENCOUNTER_TYPE_NOCONFLICT_AHEAD.
Definition: MSDevice_SSM.h:73
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...
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:88
ENCOUNTER_TYPE_FOE_ENTERED_CONFLICT_AREA.
Definition: MSDevice_SSM.h:106
void updateAndWriteOutput()
This is called once per time step in MSNet::writeOutput() and collects the surrounding vehicles...
ConflictPointInfo PET
Definition: MSDevice_SSM.h:234
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:147
double myOldestActiveEncounterBegin
begin time of the oldest active encounter
Definition: MSDevice_SSM.h:638
void storeEncountersExceedingMaxLength()
Closes encounters, whose duration exceeds the maximal encounter length. If it is classified as confli...
ENCOUNTER_TYPE_FOLLOWING.
Definition: MSDevice_SSM.h:76
bool mySaveTrajectories
This determines whether the whole trajectories of the vehicles (position, speed, ssms) shall be saved...
Definition: MSDevice_SSM.h:620
static std::string getOutputFilename(const SUMOVehicle &v, std::string deviceID)
const MSVehicle * ego
Definition: MSDevice_SSM.h:188
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:178
std::vector< double > foeDistsToConflict
Evolution of the foe vehicle&#39;s distance to the conflict point.
Definition: MSDevice_SSM.h:214
bool closingRequested
this flag is set by updateEncounter() or directly in processEncounters(), where encounters are closed...
Definition: MSDevice_SSM.h:238
Abstract in-vehicle device.
Definition: MSDevice.h:70
bool myComputeDRAC
Definition: MSDevice_SSM.h:628
ENCOUNTER_TYPE_FOLLOWING_PASSED.
Definition: MSDevice_SSM.h:119
std::vector< Encounter * > EncounterVector
Definition: MSDevice_SSM.h:291
static bool useGeoCoords(const SUMOVehicle &v)
void countDownExtraTime(double amount)
decreases myRemaingExtraTime by given amount in seconds
double foeConflictEntryTime
Times when the foe vehicle entered/left the conflict area. Currently only applies for crossing situat...
Definition: MSDevice_SSM.h:201
std::map< const MSVehicle *, FoeInfo * > FoeInfoMap
Definition: MSDevice_SSM.h:292
const MSLane * egoConflictLane
Definition: MSDevice_SSM.h:279
Trajectory egoTrajectory
Trajectory of the ego vehicle.
Definition: MSDevice_SSM.h:208
static std::set< MSDevice * > * instances
All currently existing SSM devices.
Definition: MSDevice_SSM.h:66
~MSDevice_SSM()
Destructor.
Structure to collect some info on the encounter needed during ssm calculation by various functions...
Definition: MSDevice_SSM.h:250
std::vector< double > timeSpan
time points corresponding to the trajectories
Definition: MSDevice_SSM.h:204
A storage for options typed value containers)
Definition: OptionsCont.h:98
ENCOUNTER_TYPE_EGO_LEFT_CONFLICT_AREA.
Definition: MSDevice_SSM.h:108
std::pair< double, double > pet
Definition: MSDevice_SSM.h:269
std::map< std::string, double > myThresholds
Definition: MSDevice_SSM.h:617
ConflictPointInfo stores some information on a specific conflict point (used to store information on ...
Definition: MSDevice_SSM.h:139
Encounter & operator=(const Encounter &)
Invalidated assignment operator.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
An encounter is an episode involving two vehicles, which are closer to each other than some specified...
Definition: MSDevice_SSM.h:127
double myExtraTime
Extra time in seconds to be logged after a conflict is over.
Definition: MSDevice_SSM.h:624
std::vector< int > typeSpan
Evolution of the encounter classification (.
Definition: MSDevice_SSM.h:206
double remainingExtraTime
Remaining extra time (decreases after an encounter ended)
Definition: MSDevice_SSM.h:196
ENCOUNTER_TYPE_ON_ADJACENT_LANES.
Definition: MSDevice_SSM.h:82
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:647
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
EncounterQueue myPastConflicts
Past encounters that where qualified as conflicts and are not yet flushed to the output file...
Definition: MSDevice_SSM.h:640
double value
value of the corresponding SSM
Definition: MSDevice_SSM.h:149
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into)
Build devices for the given vehicle, if needed.
Trajectory foeTrajectory
Trajectory of the foe vehicle.
Definition: MSDevice_SSM.h:210
static void findSurroundingVehicles(const MSVehicle &veh, double range, FoeInfoMap &foeCollector)
Returns all vehicles, which are within the given range of the given vehicle.
std::priority_queue< Encounter *, std::vector< Encounter * >, Encounter::compare > EncounterQueue
Definition: MSDevice_SSM.h:290
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:409