119 StateAndDist(
int _state,
double _latDist,
double _targetDist,
int _dir) :
196 }
else if (dir == 0) {
203 void saveLCState(
const int dir,
const int stateWithoutTraCI,
const int state) {
204 const auto pair = std::make_pair(stateWithoutTraCI |
getCanceledState(dir), state);
207 }
else if (dir == 0) {
220 void saveNeighbors(
const int dir,
const std::pair<MSVehicle* const, double>& follower,
const std::pair<MSVehicle* const, double>& leader);
226 const std::shared_ptr<MSLeaderDistanceInfo>
getFollowers(
const int dir);
229 const std::shared_ptr<MSLeaderDistanceInfo>
getLeaders(
const int dir);
234 }
else if (dir == 0) {
260 const std::pair<MSVehicle*, double>& leader,
261 const std::pair<MSVehicle*, double>& neighLead,
262 const std::pair<MSVehicle*, double>& neighFollow,
264 const std::vector<MSVehicle::LaneQ>& preb,
290 const std::vector<MSVehicle::LaneQ>& preb,
293 double& latDist,
double& targetDistLat,
int& blocked) {
342 virtual double patchSpeed(
const double min,
const double wanted,
const double max,
437 virtual double estimateLCDuration(
const double speed,
const double remainingManeuverDist,
const double decel)
const;
557 virtual double computeSpeedLat(
double latDist,
double& maneuverDist)
const;
569 virtual void setParameter(
const std::string& key,
const std::string& value) {
584 virtual bool predInteraction(
const std::pair<MSVehicle*, double>& leader);
std::pair< const MSVehicle *, double > CLeaderDist
LaneChangeAction
The state of a vehicle's lane-change behavior.
#define UNUSED_PARAMETER(x)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class responsible for exchanging messages between cars involved in lane-change interaction.
MSVehicle * myNeighFollower
The follower on the lane the vehicle want to change to.
void * informNeighFollower(void *info, MSVehicle *sender)
Informs the follower on the desired lane.
void * informLeader(void *info, MSVehicle *sender)
Informs the leader on the same lane.
void * informNeighLeader(void *info, MSVehicle *sender)
Informs the leader on the desired lane.
MSLCMessager(MSVehicle *leader, MSVehicle *neighLead, MSVehicle *neighFollow)
Constructor.
~MSLCMessager()
Destructor.
MSVehicle * myNeighLeader
The leader on the lane the vehicle want to change to.
MSVehicle * myLeader
The leader on the informed vehicle's lane.
Interface for lane-change models.
bool isStrategicBlocked() const
double getLaneChangeCompletion() const
Get the current lane change completion ratio.
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key
void setShadowPartialOccupator(MSLane *lane)
void saveLCState(const int dir, const int stateWithoutTraCI, const int state)
double myAccelerationLat
the current lateral acceleration
void setFollowerGaps(CLeaderDist follower, double secGap)
std::vector< MSLane * > myFurtherTargetLanes
MSLane * updateTargetLane()
bool myAlreadyChanged
whether the vehicle has already moved this step
bool myAmOpposite
whether the vehicle is driving in the opposite direction
double getPreviousManeuverDist() const
std::shared_ptr< MSLeaderDistanceInfo > myRightFollowers
std::pair< int, int > mySavedStateCenter
SUMOTime getLastLaneChangeOffset() const
std::shared_ptr< MSLeaderDistanceInfo > myRightLeaders
virtual void setOwnState(const int state)
bool pastMidpoint() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver
const std::vector< double > & getShadowFurtherLanesPosLat() const
virtual double getAssumedDecelForLaneChangeDuration() const
Returns a deceleration value which is used for the estimation of the duration of a lane change.
double getCommittedSpeed() const
std::shared_ptr< MSLeaderDistanceInfo > myLeftLeaders
int myPreviousState
lane changing state from the previous simulation step
virtual double estimateLCDuration(const double speed, const double remainingManeuverDist, const double decel) const
Calculates the maximal time needed to complete a lane change maneuver if lcMaxSpeedLatFactor and lcMa...
static bool outputLCEnded()
whether start of maneuvers shall be recorede
double getManeuverDist() const
Returns the remaining unblocked distance for the current maneuver. (only used by sublane model)
int getLaneChangeDirection() const
return the direction of the current lane change maneuver
int myOwnState
The current state of the vehicle.
double myLastOrigLeaderGap
acutal and secure distance to closest leader vehicle on the original when performing lane change
virtual bool predInteraction(const std::pair< MSVehicle *, double > &leader)
void laneChangeOutput(const std::string &tag, MSLane *source, MSLane *target, int direction, double maneuverDist=0)
called once the vehicle ends a lane change manoeuvre (non-instant)
virtual void prepareStep()
bool myDontResetLCGaps
Flag to prevent resetting the memorized values for LC relevant gaps until the LC output is triggered ...
void resetChanged()
reset the flag whether a vehicle already moved to false
int myPreviousState2
lane changing state from step before the previous simulation step
static bool haveLateralDynamics()
whether any kind of lateral dynamics is active
const std::shared_ptr< MSLeaderDistanceInfo > getFollowers(const int dir)
Returns the neighboring, lc-relevant followers for the last step in the requested direction.
double myLastLateralGapRight
double myCommittedSpeed
the speed when committing to a change maneuver
MSLane * getShadowLane() const
Returns the lane the vehicle's shadow is on during continuous/sublane lane change.
std::pair< int, int > mySavedStateLeft
void initLastLaneChangeOffset(int dir)
std::shared_ptr< MSLeaderDistanceInfo > myLeftFollowers
Cached info on lc-relevant neighboring vehicles.
static bool myLCOutput
whether to record lane-changing
bool startLaneChangeManeuver(MSLane *source, MSLane *target, int direction)
start the lane change maneuver and return whether it continues
virtual 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 method gets th...
std::pair< int, int > mySavedStateRight
std::vector< MSLane * > myPartiallyOccupatedByShadow
list of lanes where the shadow vehicle is partial occupator
double myLastLeaderSecureGap
the minimum longitudinal distances to vehicles on the target lane that would be necessary for stringe...
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
virtual double getSafetyFactor() const
return factor for modifying the safety constraints of the car-following model
static const double NO_NEIGHBOR
int & getCanceledState(const int dir)
static bool myAllowOvertakingRight
whether overtaking on the right is permitted
std::vector< MSLink * > myApproachedByShadow
links which are approached by the shadow vehicle
static bool haveLCOutput()
whether lanechange-output is active
virtual void updateExpectedSublaneSpeeds(const MSLeaderDistanceInfo &ahead, int sublaneOffset, int laneIndex)
update expected speeds for each sublane of the current edge
virtual void * inform(void *info, MSVehicle *sender)=0
static bool myLCStartedOutput
virtual double getOppositeSafetyFactor() const
return factor for modifying the safety constraints for opposite-diretction overtaking of the car-foll...
void setLeaderGaps(CLeaderDist, double secGap)
const std::shared_ptr< MSLeaderDistanceInfo > getLeaders(const int dir)
Returns the neighboring, lc-relevant leaders for the last step in the requested direction.
std::vector< MSLane * > myNoPartiallyOccupatedByShadow
MSAbstractLaneChangeModel & operator=(const MSAbstractLaneChangeModel &s)
Invalidated assignment operator.
const std::vector< MSLane * > & getShadowFurtherLanes() const
const std::pair< int, int > & getSavedState(const int dir) const
double myLastFollowerSpeed
double myMaxSpeedLatFactor
void setNoShadowPartialOccupator(MSLane *lane)
const LaneChangeModel myModel
the type of this model
bool cancelRequest(int state, int laneOffset)
whether the influencer cancels the given request
double myLastLeaderGap
the actual minimum longitudinal distances to vehicles on the target lane
SUMOTime remainingTime() const
Compute the remaining time until LC completion.
virtual double computeSpeedLat(double latDist, double &maneuverDist) const
decides the next lateral speed depending on the remaining lane change distance to be covered and upda...
virtual LaneChangeModel getModelID() const =0
Returns the model's ID;.
double getAccelerationLat() const
return the lateral speed of the current lane change maneuver
void setOrigLeaderGaps(CLeaderDist, double secGap)
virtual 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 &targetDistLat, int &blocked)
void setManeuverDist(const double dist)
Updates the remaining distance for the current maneuver while it is continued within non-action steps...
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
const std::vector< MSLane * > & getFurtherTargetLanes() const
virtual double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)=0
Called to adapt the speed in order to allow a lane change. It uses information on LC-related desired ...
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
void changedToOpposite()
called when a vehicle changes between lanes in opposite directions
void setSpeedLat(double speedLat)
set the lateral speed and update lateral acceleraton
MSLane * myTargetLane
The target lane for the vehicle's current maneuver.
MSLane * determineTargetLane(int &targetDir) const
double myPreviousManeuverDist
Maneuver distance from the previous simulation step.
static bool myLCEndedOutput
std::vector< double > myShadowFurtherLanesPosLat
double myLastFollowerSecureGap
double myLastOrigLeaderSecureGap
double myLastOrigLeaderSpeed
MSLane * myShadowLane
A lane that is partially occupied by the front of the vehicle but that is not the primary lane.
double mySpeedLat
the current lateral speed
virtual void updateSafeLatDist(const double travelledLatDist)
Updates the value of safe lateral distances (in SL2015) during maneuver continuation in non-action st...
int myCanceledStateCenter
void checkTraCICommands()
Check for commands issued for the vehicle via TraCI and apply the appropriate state changes For the s...
const MSCFModel & myCarFollowModel
The vehicle's car following model.
double myManeuverDist
The complete lateral distance the vehicle wants to travel to finish its maneuver Only used by sublane...
int myLaneChangeDirection
direction of the lane change maneuver -1 means right, 1 means left
void primaryLaneChanged(MSLane *source, MSLane *target, int direction)
called once when the vehicles primary lane changes
int getShadowDirection() const
return the direction in which the current shadow lane lies
double myMaxSpeedLatStanding
double myLastLeaderSpeed
speeds of surrounding vehicles at the time of lane change
virtual void saveBlockerLength(double length)
reserve space at the end of the lane to avoid dead locks
MSAbstractLaneChangeModel(MSVehicle &v, const LaneChangeModel model)
Constructor.
MSVehicle & myVehicle
The vehicle this lane-changer belongs to.
virtual 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 myLastLateralGapLeft
the minimum lateral gaps to other vehicles that were found when last changing to the left and right
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
SUMOTime myLastLaneChangeOffset
MSLane * getTargetLane() const
Returns the lane the vehicle has committed to enter during a sublane lane change.
virtual ~MSAbstractLaneChangeModel()
Destructor.
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
virtual bool sublaneChangeCompleted(const double latDist) const
whether the current change completes the manoeuvre
bool alreadyChanged() const
reset the flag whether a vehicle already moved to false
virtual StateAndDist decideDirection(StateAndDist sd1, StateAndDist sd2) const
decide in which direction to move in case both directions are desirable
double getAngleOffset() const
return the angle offset during a continuous change maneuver
void setShadowLane(MSLane *lane)
set the shadow lane
void memorizeGapsAtLCInit()
Control for resetting the memorized values for LC relevant gaps until the LC output is triggered in t...
static bool outputLCStarted()
whether start of maneuvers shall be recorede
double myLaneChangeCompletion
progress of the lane change maneuver 0:started, 1:complete
virtual bool debugVehicle() const
whether the current vehicles shall be debugged
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
std::vector< MSLane * > myShadowFurtherLanes
virtual bool congested(const MSVehicle *const neighLeader)
void clearNeighbors()
Clear info on neighboring vehicle from previous step.
void saveNeighbors(const int dir, const MSLeaderDistanceInfo &followers, const MSLeaderDistanceInfo &leaders)
Saves the lane change relevant vehicles, which are currently on neighboring lanes in the given direct...
void removeShadowApproachingInformation() const
The car-following model abstraction.
static double gLateralResolution
static SUMOTime gLaneChangeDuration
Representation of a lane in the micro simulation.
saves leader/follower vehicles and their distances relative to an ego vehicle
Notification
Definition of a vehicle state.
@ NOTIFICATION_LANE_CHANGE
The vehicle changes lanes (micro only)
Representation of a vehicle in the micro simulation.
MSAbstractLaneChangeModel & getLaneChangeModel()
A storage for options typed value containers)
StateAndDist(int _state, double _latDist, double _targetDist, int _dir)
bool sameDirection(const StateAndDist &other) const