65 throw ProcessError(
"Lane change model '" +
toString(lcm) +
"' is not compatible with sublane simulation");
116 if (neighLeader == 0) {
136 if (leader.first == 0) {
140 if (leader.first->getSpeed() < (80.0 / 3.6)) {
226 std::cout <<
SIMTIME <<
" veh=" <<
myVehicle.
getID() <<
" posLat=" << posLat <<
" overlap=" << overlap <<
"\n";
231 const int shadowDirection = posLat < 0 ? -1 : 1;
252 std::cout <<
SIMTIME <<
" cleanupShadowLane\n";
259 std::cout <<
SIMTIME <<
" cleanupShadowLane2\n";
261 (*it)->resetPartialOccupation(&
myVehicle);
279 }
else if (dir < 0) {
288 std::cout <<
SIMTIME <<
" updateShadowLane\n";
293 std::vector<MSLane*> passed;
298 assert(further.size() == furtherPosLat.size());
300 for (
int i = 0; i < (int)further.size(); ++i) {
303 std::cout <<
SIMTIME <<
" further=" << further[i]->getID() <<
" shadowFurther=" <<
Named::getIDSecure(shadowFurther) <<
"\n";
306 passed.push_back(shadowFurther);
309 std::reverse(passed.begin(), passed.end());
381 if (follower.first != 0) {
382 myLastFollowerGap = follower.second + follower.first->getVehicleType().getMinGap();
389 if (leader.first != 0) {
400 for (
int i = rightmost; i <= leftmost; ++i) {
402 if (vehDist.first != 0) {
404 const MSVehicle* follower = vehDist.first;
419 for (
int i = rightmost; i <= leftmost; ++i) {
421 if (vehDist.first != 0) {
double getMinGap() const
Get the free space in front of vehicles of this class.
static double gLateralResolution
A lane change model developed by J. Erdmann.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
saves leader/follower vehicles and their distances relative to an ego vehicle
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
const std::vector< double > & getFurtherLanesPosLat() const
double getCenterOnEdge() const
double myLastLateralGapRight
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
bool hasInfluencer() const
void setLeaderGaps(CLeaderDist, double secGap)
virtual bool debugVehicle() const
whether the current vehicles shall be debugged
virtual double interactionGap(const MSVehicle *const veh, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
double myLastLeaderGap
the actual minimum longitudinal distances to vehicles on the target lane
double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
double myLaneChangeCompletion
progress of the lane change maneuver 0:started, 1:complete
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
int getShadowDirection() const
return the direction in which the current shadow lane lies
Notification
Definition of a vehicle state.
std::string time2string(SUMOTime t)
static bool myLCOutput
whether to record lane-changing
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
void leftByLaneChange(MSVehicle *v)
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)
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
#define UNUSED_PARAMETER(x)
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
#define WRITE_WARNING(msg)
Right blinker lights are switched on.
std::vector< double > myShadowFurtherLanesPosLat
void setFollowerGaps(CLeaderDist follower, double secGap)
const LaneChangeModel myModel
the type of this model
static bool myAllowOvertakingRight
whether overtaking on the right is permitted
const std::string & getID() const
Returns the id.
void leaveLane(const MSMoveReminder::Notification reason, const MSLane *approachedLane=0)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
The vehicle changes lanes (micro only)
A lane change model developed by D. Krajzewicz, J. Erdmann et al. between 2004 and 2013...
Left blinker lights are switched on.
bool cancelRequest(int state)
whether the influencer cancels the given request
std::vector< MSLane * > myNoPartiallyOccupatedByShadow
void setSublaneChange(double latDist)
Sets a new sublane-change request.
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)
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
void enteredByLaneChange(MSVehicle *v)
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
std::vector< MSLane * > myShadowFurtherLanes
void getSubLanes(const MSVehicle *veh, double latOffset, int &rightmost, int &leftmost) const
void removeShadowApproachingInformation() const
double updateFurtherLanes(std::vector< MSLane * > &furtherLanes, std::vector< double > &furtherLanesPosLat, const std::vector< MSLane * > &passedLanes)
update a vector of further lanes and return the new backPos
int myLaneChangeDirection
direction of the lane change maneuver -1 means right, 1 means left
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuous/sublane lane change. ...
void fixPosition()
repair errors in vehicle position after changing between internal edges
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.
int getIndex() const
Returns the lane's index.
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
void primaryLaneChanged(MSLane *source, MSLane *target, int direction)
called once when the vehicles primary lane changes
MSVehicle & myVehicle
The vehicle this lane-changer belongs to.
std::pair< const MSVehicle *, double > CLeaderDist
const std::vector< MSLane * > & getFurtherLanes() const
trigger: the time of the step
Influencer & getInfluencer()
Returns the velocity/lane influencer.
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
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
A storage for options typed value containers)
double mySpeedLat
the current lateral speed
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
const std::string & getID() const
Returns the name of the vehicle type.
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
The abstract direction of a link.
A lane change model developed by D. Krajzewicz between 2004 and 2010.
Static storage of an output device and its base (abstract) implementation.
void changedToOpposite()
called when a vehicle changes between lanes in opposite directions
bool closeTag()
Closes the most recently opened tag.
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
double myCommittedSpeed
the speed when committing to a change maneuver
std::vector< MSLink * > myApproachedByShadow
links which are approached by the shadow vehicle
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane ...
MSLane * getLane() const
Returns the lane the vehicle is on.
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
double myLastLateralGapLeft
the minimum lateral gaps to other vehicles that were found when last changing to the left and right ...
static SUMOTime gLaneChangeDuration
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.
Interface for lane-change models.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
const std::string & getID() const
Returns the name of the vehicle.
virtual bool congested(const MSVehicle *const neighLeader)
double getSpeed() const
Returns the vehicle's current speed.
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
virtual ~MSAbstractLaneChangeModel()
Destructor.