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