 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
17 #ifndef MSLCM_SL2015_h
18 #define MSLCM_SL2015_h
69 const std::vector<MSVehicle::LaneQ>& preb,
72 double& latDist,
double& maneuverDist,
int& blocked);
84 const std::pair<MSVehicle*, double>& leader,
85 const std::pair<MSVehicle*, double>& neighLead,
86 const std::pair<MSVehicle*, double>& neighFollow,
88 const std::vector<MSVehicle::LaneQ>& preb,
104 double patchSpeed(
const double min,
const double wanted,
const double max,
107 double _patchSpeed(
const double min,
const double wanted,
const double max,
129 void setParameter(
const std::string& key,
const std::string& value);
148 const std::vector<MSVehicle::LaneQ>& preb,
151 double& latDist,
double& maneuverDist,
int& blocked);
159 const std::vector<CLeaderDist>& blockers,
160 double remainingSeconds);
164 const std::vector<CLeaderDist>& blockers,
165 double remainingSeconds,
166 double plannedSpeed);
174 double remainingSeconds);
179 double remainingSeconds,
180 double plannedSpeed);
207 return dist / (abs(laneOffset)) < lookForwardDist;
210 return dist / abs(laneOffset) > lookForwardDist;
215 typedef std::pair<double, int>
Info;
249 int checkBlocking(
const MSLane& neighLane,
double& latDist,
double& maneuverDist,
int laneOffset,
256 std::vector<CLeaderDist>* collectLeadBlockers = 0,
257 std::vector<CLeaderDist>* collectFollowBlockers = 0,
258 bool keepLatGapManeuver =
false,
259 double gapFactor = 0,
260 int* retBlockedFully = 0);
265 double& safeLatGapRight,
double& safeLatGapLeft,
266 std::vector<CLeaderDist>* collectBlockers = 0)
const;
269 static bool overlap(
double right,
double left,
double right2,
double left2);
278 const std::vector<MSVehicle::LaneQ>& preb,
287 int roundaboutEdgesAhead,
304 double& maneuverDist,
310 double& surplusGapRight,
double& surplusGapLeft,
bool saveMinGap =
false,
double netOverlap = 0,
312 std::vector<CLeaderDist>* collectBlockers = 0);
333 double maneuverDist);
339 double computeSpeedGain(
double latDistSublane,
double defaultNextSpeed)
const;
static int lowest_bit(int changeReason)
return the most important change reason
void setOwnState(const int state)
double myKeepRightProbability
double getLateralDrift()
get lateral drift for the current step
Representation of a lane in the micro simulation.
bool myDontBrake
flag to prevent speed adaptation by slowing down
int checkBlocking(const MSLane &neighLane, double &latDist, double &maneuverDist, int laneOffset, const MSLeaderDistanceInfo &leaders, const MSLeaderDistanceInfo &followers, const MSLeaderDistanceInfo &blockers, const MSLeaderDistanceInfo &neighLeaders, const MSLeaderDistanceInfo &neighFollowers, const MSLeaderDistanceInfo &neighBlockers, std::vector< CLeaderDist > *collectLeadBlockers=0, std::vector< CLeaderDist > *collectFollowBlockers=0, bool keepLatGapManeuver=false, double gapFactor=0, int *retBlockedFully=0)
restrict latDist to permissible speed and determine blocking state depending on that distance
saves leader/follower vehicles and their distances relative to an ego vehicle
A class responsible for exchanging messages between cars involved in lane-change interaction.
void updateExpectedSublaneSpeeds(const MSLeaderDistanceInfo &ahead, int sublaneOffset, int laneIndex)
update expected speeds for each sublane of the current edge
std::vector< double > myExpectedSublaneSpeeds
expected travel speeds on all sublanes on the current edge(!)
int computeSublaneShift(const MSEdge *prevEdge, const MSEdge *curEdge)
compute shift so that prevSublane + shift = newSublane
double getSublaneWidth()
return the current sublane width (and return a sensible value when running without sublanes)
void saveBlockerLength(const MSVehicle *blocker, int lcaCounter)
save space for vehicles which need to counter-lane-change
int wantsChangeSublane(int laneOffset, LaneChangeAction alternatives, const MSLeaderDistanceInfo &leaders, const MSLeaderDistanceInfo &followers, const MSLeaderDistanceInfo &blockers, const MSLeaderDistanceInfo &neighLeaders, const MSLeaderDistanceInfo &neighFollowers, const MSLeaderDistanceInfo &neighBlockers, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked, double &latDist, double &maneuverDist, int &blocked)
Called to examine whether the vehicle wants to change with the given laneOffset (using the sublane mo...
double getWidth() const
return the widht of this vehicle (padded for numerical stability)
void updateCFRelated(const MSLeaderDistanceInfo &vehicles, double foeOffset, bool leaders)
find leaders/followers that are already in a car-following relationship with ego
void initDerivedParameters()
init cached parameters derived directly from model parameters
MSLCM_SL2015(MSVehicle &v)
double mySpeedLossProbThreshold
double _patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)
void msg(const CLeaderDist &cld, double speed, int state)
send a speed recommendation to the given vehicle
static CLeaderDist getSlowest(const MSLeaderDistanceInfo &ldi)
get the slowest vehicle in the given info
double getSafetyFactor() const
return factor for modifying the safety constraints of the car-following model
double mySafeLatDistRight
the lateral distance the vehicle can safely move in the currently considered direction
static LaneChangeAction getLCA(int state, double latDist)
compute lane change action from desired lateral distance
double myTimeToImpatience
double computeGapFactor(int state) const
compute the gap factor for the given state
StateAndDist decideDirection(StateAndDist sd1, StateAndDist sd2) const
decide in which direction to move in case both directions are desirable
void saveBlockerLength(double length)
reserve space at the end of the lane to avoid dead locks
static double gLateralResolution
virtual void updateSafeLatDist(const double travelledLatDist)
Updates the value of safe lateral distances (mySafeLatDistLeft and mySafeLatDistRight) during maneuve...
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this laneChangeModel. Throw exception for unsupported key
double mySpeedGainProbabilityLeft
a value for tracking the probability that a change to the left is beneficial
void addLCSpeedAdvice(const double vSafe)
Takes a vSafe (speed advice for speed in the next simulation step), converts it into an acceleration ...
void informFollowers(int blocked, int dir, const std::vector< CLeaderDist > &blockers, double remainingSeconds, double plannedSpeed)
call informFollower for multiple followers
double myChangeProbThresholdRight
LaneChangeAction
The state of a vehicle's lane-change behavior.
@ LCA_AMBLOCKINGFOLLOWER_DONTBRAKE
static bool overlap(double right, double left, double right2, double left2)
return whether the given intervals overlap
double computeSpeedGain(double latDistSublane, double defaultNextSpeed) const
compute speedGain when moving by the given amount
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
double myTurnAlignmentDist
bool debugVehicle() const
whether the current vehicles shall be debugged
bool currentDistAllows(double dist, int laneOffset, double lookForwardDist)
A road/street connecting two junctions.
double myCooperativeParam
const MSEdge * myLastEdge
expected travel speeds on all sublanes on the current edge(!)
A lane change model developed by J. Erdmann.
void commitManoeuvre(int blocked, int blockedFully, const MSLeaderDistanceInfo &leaders, const MSLeaderDistanceInfo &neighLeaders, const MSLane &neighLane, double maneuverDist)
commit to lane change maneuvre potentially overriding safe speed
void informFollower(int blocked, int dir, const CLeaderDist &neighFollow, double remainingSeconds, double plannedSpeed)
decide whether we will try cut in before the follower or allow to be overtaken
int wantsChange(int laneOffset, MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change using the given laneOffset (this is a wrapper a...
MSLane * getLane() const
Returns the lane the vehicle is on.
bool amBlockingFollower()
int _wantsChangeSublane(int laneOffset, LaneChangeAction alternatives, const MSLeaderDistanceInfo &leaders, const MSLeaderDistanceInfo &followers, const MSLeaderDistanceInfo &blockers, const MSLeaderDistanceInfo &neighLeaders, const MSLeaderDistanceInfo &neighFollowers, const MSLeaderDistanceInfo &neighBlockers, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked, double &latDist, double &maneuverDist, int &blocked)
helper function for doing the actual work
double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)
Called to adapt the speed in order to allow a lane change. It uses information on LC-related desired ...
double informLeader(int blocked, int dir, const CLeaderDist &neighLead, double remainingSeconds)
double mySpeedGainProbabilityRight
a value for tracking the probability that a change to the right is beneficial
LaneChangeModel getModelID() const
Returns the model's id.
bool amBlockingFollowerPlusNB()
int keepLatGap(int state, const MSLeaderDistanceInfo &leaders, const MSLeaderDistanceInfo &followers, const MSLeaderDistanceInfo &blockers, const MSLeaderDistanceInfo &neighLeaders, const MSLeaderDistanceInfo &neighFollowers, const MSLeaderDistanceInfo &neighBlockers, const MSLane &neighLane, int laneOffset, double &latDist, double &maneuverDist, int &blocked)
check whether lateral gap requirements are met override the current maneuver if necessary
bool amBlockingFollowerNB()
double myLeadingBlockerLength
int myOwnState
The current state of the vehicle.
std::vector< double > myLCAccelerationAdvices
vector of LC-related acceleration recommendations Filled in wantsChange() and applied in patchSpeed()
double commitFollowSpeed(double speed, double latDist, double secondsToLeaveLane, const MSLeaderDistanceInfo &leaders, double foeOffset) const
compute speed when committing to an urgent change that is safe in regard to leading vehicles
void updateGaps(const MSLeaderDistanceInfo &others, double foeOffset, double oldCenter, double gapFactor, double &surplusGapRight, double &surplusGapLeft, bool saveMinGap=false, double netOverlap=0, double latDist=0, std::vector< CLeaderDist > *collectBlockers=0)
check remaining lateral gaps for the given foe vehicles and optionally update minimum lateral gaps
double getWidth() const
Returns the lane's width.
The car-following model abstraction.
void * inform(void *info, MSVehicle *sender)
Interface for lane-change models.
MSVehicle & myVehicle
The vehicle this lane-changer belongs to.
std::pair< double, int > Info
information regarding save velocity (unused) and state flags of the ego vehicle
double getPosLat()
get lateral position of this vehicle
std::pair< const MSVehicle *, double > CLeaderDist
double informLeaders(int blocked, int dir, const std::vector< CLeaderDist > &blockers, double remainingSeconds)
std::set< const MSVehicle * > myCFRelated
set of vehicles that are in a car-following relationship with ego (leader of followers)
int slowDownForBlocked(MSVehicle **blocked, int state)
compute useful slowdowns for blocked vehicles
static CLeaderDist getLongest(const MSLeaderDistanceInfo &ldi)
get the longest vehicle in the given info
bool myCanChangeFully
whether the current lane changing maneuver can be finished in a single step
int checkBlockingVehicles(const MSVehicle *ego, const MSLeaderDistanceInfo &vehicles, double latDist, double foeOffset, bool leaders, LaneChangeAction blockType, double &safeLatGapRight, double &safeLatGapLeft, std::vector< CLeaderDist > *collectBlockers=0) const
check whether any of the vehicles overlaps with ego
double computeSpeedLat(double latDist, double &maneuverDist)
decides the next lateral speed depending on the remaining lane change distance to be covered and upda...
double myChangeProbThresholdLeft
int checkStrategicChange(int ret, int laneOffset, const std::vector< MSVehicle::LaneQ > &preb, const MSLeaderDistanceInfo &leaders, const MSLeaderDistanceInfo &neighLeaders, int currIdx, int bestLaneOffset, bool changeToBest, double currentDist, double neighDist, double laDist, int roundaboutEdgesAhead, double latLaneDist, double &latDist)
compute strategic lane change actions TODO: Better documentation, refs #2
bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist)
Representation of a vehicle in the micro simulation.