24 #ifndef MSAbstractLaneChangeModel_h 25 #define MSAbstractLaneChangeModel_h 130 return latDist * other.
latDist > 0;
167 void saveState(
const int dir,
const int stateWithoutTraCI,
const int state) {
168 mySavedStates[dir] = std::make_pair(stateWithoutTraCI, state);
196 const std::pair<MSVehicle*, double>& leader,
197 const std::pair<MSVehicle*, double>& neighLead,
198 const std::pair<MSVehicle*, double>& neighFollow,
200 const std::vector<MSVehicle::LaneQ>& preb,
226 const std::vector<MSVehicle::LaneQ>& preb,
229 double& latDist,
int& blocked) {
275 virtual double patchSpeed(
const double min,
const double wanted,
const double max,
426 virtual void setParameter(
const std::string& key,
const std::string& value) {
436 virtual bool predInteraction(
const std::pair<MSVehicle*, double>& leader);
std::vector< MSLane * > myPartiallyOccupatedByShadow
list of lanes where the shadow vehicle is partial occupator
saves leader/follower vehicles and their distances relative to an ego vehicle
Representation of a vehicle in the micro simulation.
double myLastLateralGapRight
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, int &blocked)
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
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.
virtual bool debugVehicle() const
whether the current vehicles shall be debugged
~MSLCMessager()
Destructor.
bool alreadyChanged() const
reset the flag whether a vehicle already moved to false
double myLastLeaderGap
the actual minimum longitudinal distances to vehicles on the target lane
double myLaneChangeCompletion
progress of the lane change maneuver 0:started, 1:complete
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
The car-following model abstraction.
void * informNeighFollower(void *info, MSVehicle *sender)
Informs the follower on the desired lane.
int getShadowDirection() const
return the direction in which the current shadow lane lies
Notification
Definition of a vehicle state.
static bool myLCOutput
whether to record lane-changing
const std::pair< int, int > & getSavedState(const int dir) const
MSLCMessager(MSVehicle *leader, MSVehicle *neighLead, MSVehicle *neighFollow)
Constructor.
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)
#define UNUSED_PARAMETER(x)
MSAbstractLaneChangeModel & getLaneChangeModel()
void saveState(const int dir, const int stateWithoutTraCI, const int state)
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.
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)
void setSpeedLat(double speedLat)
The action has not been determined.
bool cancelRequest(int state)
whether the influencer cancels the given request
std::vector< MSLane * > myNoPartiallyOccupatedByShadow
double getAngleOffset() const
return the angle offset during a continuous change maneuver
double myLastFollowerSecureGap
bool pastMidpoint() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void setShadowPartialOccupator(MSLane *lane)
void setShadowLane(MSLane *lane)
set the shadow lane
virtual void updateExpectedSublaneSpeeds(const MSLeaderInfo &ahead, int sublaneOffset, int laneIndex)
update expected speeds for each sublane of the current edge
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 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...
std::vector< MSLane * > myShadowFurtherLanes
const std::vector< MSLane * > & getShadowFurtherLanes() const
bool sameDirection(const StateAndDist &other) const
void removeShadowApproachingInformation() const
virtual StateAndDist decideDirection(StateAndDist sd1, StateAndDist sd2) const
decide in which direction to move in case both directions are desirable
int myLaneChangeDirection
direction of the lane change maneuver -1 means right, 1 means left
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
const std::vector< double > & getShadowFurtherLanesPosLat() const
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuous/sublane lane change. ...
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.
StateAndDist(int _state, double _latDist, int _dir)
bool startLaneChangeManeuver(MSLane *source, MSLane *target, int direction)
start the lane change maneuver and return whether it continues
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key ...
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
LaneChangeAction
The state of a vehicle's lane-change behavior.
virtual void setOwnState(const int state)
SUMOTime remainingTime() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
SUMOTime myLastLaneChangeOffset
void setNoShadowPartialOccupator(MSLane *lane)
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)
double mySpeedLat
the current lateral speed
static bool haveLCOutput()
whether lanechange-output is active
virtual void prepareStep()
virtual void saveBlockerLength(double length)
reserve space at the end of the lane to avoid dead locks
void changedToOpposite()
called when a vehicle changes between lanes in opposite directions
double myCommittedSpeed
the speed when committing to a change maneuver
std::vector< MSLink * > myApproachedByShadow
links which are approached by the shadow vehicle
double myLastLateralGapLeft
the minimum lateral gaps to other vehicles that were found when last changing to the left and right ...
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
SUMOTime getLastLaneChangeOffset() const
MSAbstractLaneChangeModel(MSVehicle &v, const LaneChangeModel model)
Constructor.
Interface for lane-change models.
MSVehicle * myLeader
The leader on the informed vehicle's lane.
std::map< int, std::pair< int, int > > mySavedStates
int getLaneChangeDirection() const
return the direction of the current lane change maneuver
virtual bool congested(const MSVehicle *const neighLeader)
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
virtual ~MSAbstractLaneChangeModel()
Destructor.