122 StateAndDist(
int _state,
double _latDist,
double _targetDist,
int _dir) :
218 }
else if (dir == 0) {
225 void saveLCState(
const int dir,
int stateWithoutTraCI,
const int state) {
229 stateWithoutTraCI = canceledStrategic;
231 const auto pair = std::make_pair(stateWithoutTraCI, state);
234 }
else if (dir == 0) {
247 void saveNeighbors(
const int dir,
const std::pair<MSVehicle* const, double>& follower,
const std::pair<MSVehicle* const, double>& leader);
253 const std::shared_ptr<MSLeaderDistanceInfo>
getFollowers(
const int dir);
256 const std::shared_ptr<MSLeaderDistanceInfo>
getLeaders(
const int dir);
261 }
else if (dir == 0) {
287 const std::pair<MSVehicle*, double>& leader,
288 const std::pair<MSVehicle*, double>& follower,
289 const std::pair<MSVehicle*, double>& neighLead,
290 const std::pair<MSVehicle*, double>& neighFollow,
292 const std::vector<MSVehicle::LaneQ>& preb,
319 const std::vector<MSVehicle::LaneQ>& preb,
322 double& latDist,
double& targetDistLat,
int& blocked) {
371 virtual double patchSpeed(
const double min,
const double wanted,
const double max,
464 virtual double estimateLCDuration(
const double speed,
const double remainingManeuverDist,
const double decel,
bool urgent)
const;
606 virtual double computeSpeedLat(
double latDist,
double& maneuverDist,
bool urgent)
const;
618 virtual void setParameter(
const std::string& key,
const std::string& value) {
648 virtual bool predInteraction(
const std::pair<MSVehicle*, double>& leader);
std::pair< const MSVehicle *, double > CLeaderDist
LatAlignmentDefinition
Possible ways to choose the lateral alignment, i.e., how vehicles align themselves within their lane.
LaneChangeAction
The state of a vehicle's lane-change behavior.
@ LCA_WANTS_LANECHANGE_OR_STAY
lane can change or stay
#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.
MSLCMessager(MSVehicle *leader, MSVehicle *neighLead, MSVehicle *neighFollow)
Constructor.
~MSLCMessager()
Destructor.
MSVehicle * myNeighLeader
The leader on the lane the vehicle want to change to.
void * informLeader(void *info, MSVehicle *sender)
Informs the leader on the same lane.
void * informNeighFollower(void *info, MSVehicle *sender)
Informs the follower on the desired lane.
MSVehicle * myLeader
The leader on the informed vehicle's lane.
void * informNeighLeader(void *info, MSVehicle *sender)
Informs the leader on the desired lane.
Interface for lane-change models.
bool isStrategicBlocked() const
double getLaneChangeCompletion() const
Get the current lane change completion ratio.
double getForwardPos() const
get vehicle position relative to the forward direction lane
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)
double myAccelerationLat
the current lateral acceleration
void setFollowerGaps(CLeaderDist follower, double secGap)
std::vector< MSLane * > myFurtherTargetLanes
MSAbstractLaneChangeModel & operator=(const MSAbstractLaneChangeModel &s)
Invalidated assignment operator.
MSLane * updateTargetLane()
bool myAlreadyChanged
whether the vehicle has already moved this step
bool hasBlueLight() const
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
double myPreviousAngleOffset
the angle offset of the previous time step resulting from lane change and sigma
virtual double getAssumedDecelForLaneChangeDuration() const
Returns a deceleration value which is used for the estimation of the duration of a lane change.
double getCommittedSpeed() const
virtual double computeSpeedLat(double latDist, double &maneuverDist, bool urgent) const
decides the next lateral speed depending on the remaining lane change distance to be covered and upda...
virtual double estimateLCDuration(const double speed, const double remainingManeuverDist, const double decel, bool urgent) const
Calculates the maximal time needed to complete a lane change maneuver if lcMaxSpeedLatFactor and lcMa...
virtual void resetSpeedLat()
std::shared_ptr< MSLeaderDistanceInfo > myLeftLeaders
int myPreviousState
lane changing state from the previous simulation step
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
MSLane * getShadowLane() const
Returns the lane the vehicle's shadow is on during continuous/sublane lane change.
const std::shared_ptr< MSLeaderDistanceInfo > getFollowers(const int dir)
Returns the neighboring, lc-relevant followers for the last step in the requested direction.
void setAngleOffset(const double angleOffset)
set the angle offset resulting from lane change and sigma
double myLastLateralGapRight
double myCommittedSpeed
the speed when committing to a change maneuver
virtual LatAlignmentDefinition getDesiredAlignment() const
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 double getExtraReservation(int) const
reserve extra space for unseen blockers when more tnan one lane change is required
virtual void saveState(OutputDevice &out) const
Save the state of the laneChangeModel.
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
double myMaxDistLatStanding
void saveLCState(const int dir, int stateWithoutTraCI, const int state)
static bool myAllowOvertakingRight
whether overtaking on the right is permitted
bool myHaveBlueLight
whether this vehicle is driving with special permissions and behavior
virtual bool saveBlockerLength(double, double)
reserve space at the end of the lane to avoid dead locks
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
void addLCSpeedAdvice(const double vSafe, bool ownAdvice=true)
Takes a vSafe (speed advice for speed in the next simulation step), converts it into an acceleration ...
virtual int wantsChange(int laneOffset, MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &follower, 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...
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
int & getCanceledState(const int dir)
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
MSLane * getTargetLane() const
Returns the lane the vehicle has committed to enter during a sublane lane change.
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 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...
std::vector< std::pair< double, bool > > myLCAccelerationAdvices
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
int getNormalizedLaneIndex()
brief return lane index that treats opposite lanes like normal lanes to the left of the forward lanes
virtual int checkChangeBeforeCommitting(const MSVehicle *veh, int state) const
Informs the vehicle that it is about to be moved on an adjacent lane. The method can be used to re-ev...
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.
double myOvertakeRightParam
static bool myLCEndedOutput
double getMaxSpeedLat2() const
return the max of maxSpeedLat and lcMaxSpeedLatStanding
std::vector< double > myShadowFurtherLanesPosLat
double myLastFollowerSecureGap
const MSCFModel & getCarFollowModel() const
The vehicle's car following model.
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...
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 loadState(const SUMOSAXAttributes &attrs)
Loads the state of the laneChangeModel from the given attributes.
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 calcAngleOffset()
return the angle offset during a continuous change maneuver
void setPreviousAngleOffset(const double angleOffset)
set the angle offset of the previous time step
double myAngleOffset
the current angle offset resulting from lane change and sigma
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
const std::vector< MSLane * > & getFurtherTargetLanes() const
virtual ~MSAbstractLaneChangeModel()
Destructor.
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
virtual void resetState()
virtual bool avoidOvertakeRight() const
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 resulting from lane change and sigma
virtual void * inform(void *info, MSVehicle *sender)=0
void memorizeGapsAtLCInit()
Control for resetting the memorized values for LC relevant gaps until the LC output is triggered in t...
const std::vector< MSLane * > & getShadowFurtherLanes() const
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
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
The car-following model abstraction.
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()
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
const LatAlignmentDefinition & getPreferredLateralAlignment() const
Get vehicle's preferred lateral alignment procedure.
A storage for options typed value containers)
Static storage of an output device and its base (abstract) implementation.
Encapsulated SAX-Attributes.
StateAndDist(int _state, double _latDist, double _targetDist, int _dir)
bool sameDirection(const StateAndDist &other) const