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