20 #ifndef MSLCM_SL2015_h 21 #define MSLCM_SL2015_h 80 const std::vector<MSVehicle::LaneQ>& preb,
83 double& latDist,
int& blocked);
92 const std::pair<MSVehicle*, double>& leader,
93 const std::pair<MSVehicle*, double>& neighLead,
94 const std::pair<MSVehicle*, double>& neighFollow,
96 const std::vector<MSVehicle::LaneQ>& preb,
129 void setParameter(
const std::string& key,
const std::string& value);
143 const std::vector<MSVehicle::LaneQ>& preb,
146 double& latDist,
int& blocked);
154 const std::vector<CLeaderDist>& blockers,
155 double remainingSeconds);
159 const std::vector<CLeaderDist>& blockers,
160 double remainingSeconds,
161 double plannedSpeed);
169 double remainingSeconds);
174 double remainingSeconds,
175 double plannedSpeed);
202 return dist / (
abs(laneOffset)) < lookForwardDist;
205 return dist /
abs(laneOffset) > lookForwardDist;
209 typedef std::pair<double, int>
Info;
240 std::vector<CLeaderDist>* collectLeadBlockers = 0,
241 std::vector<CLeaderDist>* collectFollowBlockers = 0,
242 bool keepLatGapManeuver =
false);
247 std::vector<CLeaderDist>* collectBlockers = 0)
const;
250 static bool overlap(
double right,
double left,
double right2,
double left2);
258 const std::vector<MSVehicle::LaneQ>& preb,
268 int roundaboutEdgesAhead,
289 double& surplusGapRight,
double& surplusGapLeft,
bool saveMinGap =
false,
double netOverlap = 0);
void * inform(void *info, MSVehicle *sender)
const double mySpeedLossProbThreshold
A lane change model developed by J. Erdmann.
saves leader/follower vehicles and their distances relative to an ego vehicle
Representation of a vehicle in the micro simulation.
void msg(const CLeaderDist &cld, double speed, int state)
send a speed recommendation to the given vehicle
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
double informLeaders(int blocked, int dir, const std::vector< CLeaderDist > &blockers, double remainingSeconds)
bool myCanChangeFully
whether the current lane changing meneuver can be finished in a single step
bool debugVehicle() const
whether the current vehicles shall be debugged
void saveBlockerLength(double length)
reserve space at the end of the lane to avoid dead locks
const 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, int lcaCounter, double currentDist, double neighDist, double laDist, int roundaboutEdgesAhead, double latLaneDist, double &latDist)
compute strategic lane change actions
The car-following model abstraction.
void setOwnState(const int state)
static CLeaderDist getSlowest(const MSLeaderDistanceInfo &ldi)
get the slowest vehicle in the given info
void updateExpectedSublaneSpeeds(const MSLeaderInfo &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 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, int &blocked)
check whether lateral gap requirements are met override the current maneuver if necessary ...
StateAndDist decideDirection(StateAndDist sd1, StateAndDist sd2) const
decide in which direction to move in case both directions are desirable
bool amBlockingFollower()
MSLCM_SL2015(MSVehicle &v)
std::vector< double > myVSafes
speed adaptation requests by ego and surrounding vehicles
void saveBlockerLength(const MSVehicle *blocker, int lcaCounter)
save space for vehicles which need to counter-lane-change
static bool overlap(double right, double left, double right2, double left2)
return whether the given intervals overlap
A class responsible for exchanging messages between cars involved in lane-change interaction.
A road/street connecting two junctions.
double myLeadingBlockerLength
int checkBlockingVehicles(const MSVehicle *ego, const MSLeaderDistanceInfo &vehicles, double latDist, double foeOffset, bool leaders, LaneChangeAction blockType, std::vector< CLeaderDist > *collectBlockers=0) const
check whether any of the vehicles overlaps with ego
const MSEdge * myLastEdge
expected travel speeds on all sublanes on the current edge(!)
double informLeader(int blocked, int dir, const CLeaderDist &neighLead, double remainingSeconds)
static LaneChangeAction getLCA(int state, double latDist)
compute lane change action from desired lateral distance
void informFollowers(int blocked, int dir, const std::vector< CLeaderDist > &blockers, double remainingSeconds, double plannedSpeed)
call informFollower for multiple followers
bool amBlockingFollowerNB()
void updateGaps(const MSLeaderDistanceInfo &others, double foeOffset, double oldCenter, double gapFactor, double &surplusGapRight, double &surplusGapLeft, bool saveMinGap=false, double netOverlap=0)
check remaining lateral gaps for the given foe vehicles and optionally update minimum lateral gaps ...
double _patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)
int myOwnState
The current state of the vehicle.
static CLeaderDist getLongest(const MSLeaderDistanceInfo &ldi)
get the longest vehicle in the given info
double myCooperativeParam
std::pair< double, int > Info
information regarding save velocity (unused) and state flags of the ego vehicle
int wantsChangeSublane(int laneOffset, 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, int &blocked)
Called to examine whether the vehicle wants to change with the given laneOffset (using the sublane mo...
std::pair< const MSVehicle *, double > CLeaderDist
LaneChangeAction
The state of a vehicle's lane-change behavior.
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.
double myKeepRightProbability
double myOrigLatDist
the complete lateral distance the vehicle wants to travel to finish its maneuver
int slowDownForBlocked(MSVehicle **blocked, int state)
compute useful slowdowns for blocked vehicles
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
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist)
const double myChangeProbThresholdRight
double mySpeedGainProbabilityRight
a value for tracking the probability that a change to the right is beneficial
bool currentDistAllows(double dist, int laneOffset, double lookForwardDist)
int _wantsChangeSublane(int laneOffset, 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, int &blocked)
helper function for doing the actual work
bool myDontBrake
flag to prevent speed adaptation by slowing down
int checkBlocking(const MSLane &neighLane, double &latDist, 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)
restrict latDist to permissible speed and determine blocking state depending on that distance ...
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...
Representation of a lane in the micro simulation.
int myPreviousState
lane changing state from the previous simulation step
int computeSublaneShift(const MSEdge *prevEdge, const MSEdge *curEdge)
compute shift so that prevSublane + shift = newSublane
Interface for lane-change models.
bool amBlockingFollowerPlusNB()