SUMO - Simulation of Urban MObility
MSVehicle::Influencer Class Reference

Changes the wished vehicle speed / lanes. More...

#include <MSVehicle.h>

Collaboration diagram for MSVehicle::Influencer:
Collaboration graph

Public Member Functions

double changeRequestRemainingSeconds (const SUMOTime currentTime) const
 Return the remaining number of seconds of the current laneTimeLine assuming one exists. More...
 
bool getEmergencyBrakeRedLight () const
 Returns whether red lights shall be a reason to brake. More...
 
int getLanechangeMode () const
 return the current lane change mode More...
 
SUMOTime getLastAccessTimeStep () const
 
double getLatDist () const
 
double getOriginalSpeed () const
 Returns the originally longitudinal speed to use. More...
 
bool getRespectJunctionPriority () const
 Returns whether junction priority rules shall be respected. More...
 
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT () const
 
int getRoutingMode () const
 return the current routing mode More...
 
int getSignals () const
 
int getSpeedMode () const
 return the current speed mode More...
 
double implicitDeltaPosRemote (const MSVehicle *veh)
 return the change in longitudinal position that is implicit in the new remote position More...
 
double implicitSpeedRemote (const MSVehicle *veh, double oldSpeed)
 return the speed that is implicit in the new remote position More...
 
int influenceChangeDecision (const SUMOTime currentTime, const MSEdge &currentEdge, const int currentLaneIndex, int state)
 Applies stored LaneChangeMode information and laneTimeLine. More...
 
 Influencer ()
 Constructor. More...
 
double influenceSpeed (SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax)
 Applies stored velocity information on the speed to use. More...
 
bool isRemoteAffected (SUMOTime t) const
 
bool isRemoteControlled () const
 
void postProcessRemoteControl (MSVehicle *v)
 
void resetLatDist ()
 
void setLaneChangeMode (int value)
 Sets lane changing behavior. More...
 
void setLaneTimeLine (const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
 Sets a new lane timeline. More...
 
void setRemoteControlled (Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
 
void setRoutingMode (int value)
 Sets routing behavior. More...
 
void setSignals (int signals)
 
void setSpeedMode (int speedMode)
 Sets speed-constraining behaviors. More...
 
void setSpeedTimeLine (const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
 Sets a new velocity timeline. More...
 
void setSublaneChange (double latDist)
 Sets a new sublane-change request. More...
 
 ~Influencer ()
 Destructor. More...
 

Private Attributes

bool myConsiderMaxAcceleration
 Whether the maximum acceleration shall be regarded. More...
 
bool myConsiderMaxDeceleration
 Whether the maximum deceleration shall be regarded. More...
 
bool myConsiderSafeVelocity
 Whether the safe velocity shall be regarded. More...
 
bool myEmergencyBrakeRedLight
 Whether red lights are a reason to brake. More...
 
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
 The lane usage time line to apply. More...
 
SUMOTime myLastRemoteAccess
 
double myLatDist
 The requested lateral change. More...
 
double myOriginalSpeed
 The velocity before influence. More...
 
double myRemoteAngle
 
int myRemoteEdgeOffset
 
MSLanemyRemoteLane
 
double myRemotePos
 
double myRemotePosLat
 
ConstMSEdgeVector myRemoteRoute
 
Position myRemoteXYPos
 
bool myRespectJunctionPriority
 Whether the junction priority rules are respected. More...
 
int myRoutingMode
 routing mode (see TraCIConstants.h) More...
 
bool mySpeedAdaptationStarted
 Whether influencing the speed has already started. More...
 
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
 The velocity time line to apply. More...
 
TraciLaneChangePriority myTraciLaneChangePriority
 flags for determining the priority of traci lane change requests More...
 
int myTraCISignals
 
Flags for managing conflicts between the laneChangeModel and TraCI laneTimeLine
LaneChangeMode myStrategicLC
 lane changing which is necessary to follow the current route More...
 
LaneChangeMode myCooperativeLC
 lane changing with the intent to help other vehicles More...
 
LaneChangeMode mySpeedGainLC
 lane changing to travel with higher speed More...
 
LaneChangeMode myRightDriveLC
 changing to the rightmost lane More...
 
LaneChangeMode mySublaneLC
 changing to the prefered lateral alignment More...
 

Detailed Description

Changes the wished vehicle speed / lanes.

The class is used for passing velocities or velocity profiles obtained via TraCI to the vehicle. The speed adaptation is controlled by the stored speedTimeLine Additionally, the variables myConsiderSafeVelocity, myConsiderMaxAcceleration, and myConsiderMaxDeceleration control whether the safe velocity, the maximum acceleration, and the maximum deceleration have to be regarded.

Furthermore this class is used to affect lane changing decisions according to LaneChangeMode and any given laneTimeLine

Definition at line 1329 of file MSVehicle.h.

Constructor & Destructor Documentation

◆ Influencer()

MSVehicle::Influencer::Influencer ( )

Constructor.

Definition at line 242 of file MSVehicle.cpp.

◆ ~Influencer()

MSVehicle::Influencer::~Influencer ( )

Destructor.

Definition at line 262 of file MSVehicle.cpp.

Member Function Documentation

◆ changeRequestRemainingSeconds()

double MSVehicle::Influencer::changeRequestRemainingSeconds ( const SUMOTime  currentTime) const

Return the remaining number of seconds of the current laneTimeLine assuming one exists.

Parameters
[in]currentTimeThe current simulation time
Returns
The remaining seconds to change lanes

Definition at line 430 of file MSVehicle.cpp.

References myLaneTimeLine, and STEPS2TIME.

Referenced by MSLCM_LC2013::_wantsChange(), and MSLCM_SL2015::_wantsChangeSublane().

◆ getEmergencyBrakeRedLight()

bool MSVehicle::Influencer::getEmergencyBrakeRedLight ( ) const
inline

Returns whether red lights shall be a reason to brake.

Returns
Whether red lights shall be a reason to brake

Definition at line 1407 of file MSVehicle.h.

Referenced by MSVehicle::ignoreRed(), and MSVehicle::processLaneAdvances().

◆ getLanechangeMode()

int MSVehicle::Influencer::getLanechangeMode ( ) const

return the current lane change mode

Definition at line 293 of file MSVehicle.cpp.

References myCooperativeLC, myRightDriveLC, mySpeedGainLC, myStrategicLC, mySublaneLC, and myTraciLaneChangePriority.

Referenced by libsumo::Vehicle::getLanechangeMode().

◆ getLastAccessTimeStep()

SUMOTime MSVehicle::Influencer::getLastAccessTimeStep ( ) const
inline

Definition at line 1435 of file MSVehicle.h.

References MSVehicle::isRemoteControlled().

Referenced by MSVehicle::wasRemoteControlled().

◆ getLatDist()

double MSVehicle::Influencer::getLatDist ( ) const
inline

◆ getOriginalSpeed()

double MSVehicle::Influencer::getOriginalSpeed ( ) const

Returns the originally longitudinal speed to use.

Returns
The speed given before influence or -1 if no influence is active

Definition at line 337 of file MSVehicle.cpp.

References myOriginalSpeed, and mySpeedTimeLine.

Referenced by MSVehicle::getSpeedWithoutTraciInfluence().

◆ getRespectJunctionPriority()

bool MSVehicle::Influencer::getRespectJunctionPriority ( ) const
inline

Returns whether junction priority rules shall be respected.

Returns
Whether junction priority rules be respected

Definition at line 1399 of file MSVehicle.h.

Referenced by MSLaneChanger::changeOpposite(), MSVehicle::checkRewindLinkLanes(), and MSVehicle::processLinkAproaches().

◆ getRouterTT()

SUMOAbstractRouter< MSEdge, SUMOVehicle > & MSVehicle::Influencer::getRouterTT ( ) const

◆ getRoutingMode()

int MSVehicle::Influencer::getRoutingMode ( ) const
inline

return the current routing mode

Definition at line 1362 of file MSVehicle.h.

References MSVehicle::influenceChangeDecision().

Referenced by libsumo::Vehicle::getRoutingMode().

◆ getSignals()

int MSVehicle::Influencer::getSignals ( ) const
inline

Definition at line 1455 of file MSVehicle.h.

Referenced by MSVehicle::setBlinkerInformation().

◆ getSpeedMode()

int MSVehicle::Influencer::getSpeedMode ( ) const

◆ implicitDeltaPosRemote()

double MSVehicle::Influencer::implicitDeltaPosRemote ( const MSVehicle veh)

return the change in longitudinal position that is implicit in the new remote position

Definition at line 533 of file MSVehicle.cpp.

References DIST2SPEED, Position::distanceTo2D(), MSVehicle::getDistanceToPosition(), MSLane::getEdge(), MSBaseVehicle::getMaxSpeed(), MSVehicle::getPosition(), myRemoteLane, myRemotePos, and myRemoteXYPos.

Referenced by MSVehicle::updateState().

◆ implicitSpeedRemote()

double MSVehicle::Influencer::implicitSpeedRemote ( const MSVehicle veh,
double  oldSpeed 
)

◆ influenceChangeDecision()

int MSVehicle::Influencer::influenceChangeDecision ( const SUMOTime  currentTime,
const MSEdge currentEdge,
const int  currentLaneIndex,
int  state 
)

Applies stored LaneChangeMode information and laneTimeLine.

Parameters
[in]currentTimeThe current simulation time
[in]currentEdgeThe current edge the vehicle is on
[in]currentLaneIndexThe index of the lane the vehicle is currently on
[in]stateThe LaneChangeAction flags as computed by the laneChangeModel
Returns
The new LaneChangeAction flags to use

Definition at line 343 of file MSVehicle.cpp.

References MSEdge::getLanes(), MSVehicle::LC_ALWAYS, MSVehicle::LC_NEVER, MSVehicle::LC_NOCONFLICT, LCA_BLOCKED, LCA_COOPERATIVE, LCA_KEEPRIGHT, LCA_LEFT, LCA_OVERLAPPING, LCA_RIGHT, LCA_SPEEDGAIN, LCA_STAY, LCA_STRATEGIC, LCA_SUBLANE, LCA_TRACI, LCA_URGENT, LCA_WANTS_LANECHANGE_OR_STAY, MSVehicle::LCP_ALWAYS, MSVehicle::LCP_NOOVERLAP, MSVehicle::LCP_OPPORTUNISTIC, myCooperativeLC, myLaneTimeLine, myLatDist, myRightDriveLC, mySpeedGainLC, myStrategicLC, mySublaneLC, myTraciLaneChangePriority, MSVehicle::REQUEST_HOLD, MSVehicle::REQUEST_LEFT, MSVehicle::REQUEST_NONE, MSVehicle::REQUEST_RIGHT, time2string(), toString(), and WRITE_WARNING.

Referenced by MSVehicle::influenceChangeDecision().

◆ influenceSpeed()

double MSVehicle::Influencer::influenceSpeed ( SUMOTime  currentTime,
double  speed,
double  vSafe,
double  vMin,
double  vMax 
)

Applies stored velocity information on the speed to use.

The given speed is assumed to be the non-influenced speed from longitudinal control. It is stored for further usage in "myOriginalSpeed".

Parameters
[in]currentTimeThe current simulation time
[in]speedThe undisturbed speed
[in]vSafeThe safe velocity
[in]vMinThe minimum velocity
[in]vMaxThe maximum simulation time
Returns
The speed to use

Definition at line 304 of file MSVehicle.cpp.

References DELTA_T, MAX2(), MIN2(), myConsiderMaxAcceleration, myConsiderMaxDeceleration, myConsiderSafeVelocity, myOriginalSpeed, mySpeedAdaptationStarted, mySpeedTimeLine, and STEPS2TIME.

Referenced by MSVehicle::planMoveInternal(), and MSVehicle::processTraCISpeedControl().

◆ isRemoteAffected()

bool MSVehicle::Influencer::isRemoteAffected ( SUMOTime  t) const

◆ isRemoteControlled()

bool MSVehicle::Influencer::isRemoteControlled ( ) const

◆ postProcessRemoteControl()

◆ resetLatDist()

void MSVehicle::Influencer::resetLatDist ( )
inline

Definition at line 1463 of file MSVehicle.h.

Referenced by MSAbstractLaneChangeModel::checkTraCICommands().

◆ setLaneChangeMode()

void MSVehicle::Influencer::setLaneChangeMode ( int  value)

Sets lane changing behavior.

Parameters
[in]valuea bitset controlling the different modes

Definition at line 448 of file MSVehicle.cpp.

References myCooperativeLC, myRightDriveLC, mySpeedGainLC, myStrategicLC, mySublaneLC, and myTraciLaneChangePriority.

Referenced by TraCIServerAPI_Vehicle::processSet().

◆ setLaneTimeLine()

void MSVehicle::Influencer::setLaneTimeLine ( const std::vector< std::pair< SUMOTime, int > > &  laneTimeLine)

Sets a new lane timeline.

Parameters
[in]laneTimeLineThe time line of lanes to use

Definition at line 273 of file MSVehicle.cpp.

References myLaneTimeLine.

Referenced by libsumo::Vehicle::changeLane().

◆ setRemoteControlled()

void MSVehicle::Influencer::setRemoteControlled ( Position  xyPos,
MSLane l,
double  pos,
double  posLat,
double  angle,
int  edgeOffset,
const ConstMSEdgeVector route,
SUMOTime  t 
)

◆ setRoutingMode()

void MSVehicle::Influencer::setRoutingMode ( int  value)
inline

Sets routing behavior.

Parameters
[in]valuean enum value controlling the different modes

Definition at line 1424 of file MSVehicle.h.

Referenced by TraCIServerAPI_Vehicle::processSet().

◆ setSignals()

void MSVehicle::Influencer::setSignals ( int  signals)
inline

Definition at line 1451 of file MSVehicle.h.

Referenced by MSVehicle::setBlinkerInformation(), and libsumo::Vehicle::setSignals().

◆ setSpeedMode()

void MSVehicle::Influencer::setSpeedMode ( int  speedMode)

Sets speed-constraining behaviors.

Parameters
[in]valuea bitset controlling the different modes

Definition at line 438 of file MSVehicle.cpp.

References myConsiderMaxAcceleration, myConsiderMaxDeceleration, myConsiderSafeVelocity, myEmergencyBrakeRedLight, and myRespectJunctionPriority.

Referenced by TraCIServerAPI_Vehicle::processSet().

◆ setSpeedTimeLine()

void MSVehicle::Influencer::setSpeedTimeLine ( const std::vector< std::pair< SUMOTime, double > > &  speedTimeLine)

Sets a new velocity timeline.

Parameters
[in]speedTimeLineThe time line of speeds to use

Definition at line 266 of file MSVehicle.cpp.

References mySpeedAdaptationStarted, and mySpeedTimeLine.

Referenced by TraCIServerAPI_Vehicle::processSet(), and libsumo::Vehicle::slowDown().

◆ setSublaneChange()

void MSVehicle::Influencer::setSublaneChange ( double  latDist)

Sets a new sublane-change request.

Parameters
[in]latDistThe lateral distance for changing

Definition at line 278 of file MSVehicle.cpp.

References myLatDist.

Referenced by libsumo::Vehicle::changeSublane(), and MSLaneChangerSublane::startChangeSublane().

Field Documentation

◆ myConsiderMaxAcceleration

bool MSVehicle::Influencer::myConsiderMaxAcceleration
private

Whether the maximum acceleration shall be regarded.

Definition at line 1489 of file MSVehicle.h.

Referenced by getSpeedMode(), influenceSpeed(), and setSpeedMode().

◆ myConsiderMaxDeceleration

bool MSVehicle::Influencer::myConsiderMaxDeceleration
private

Whether the maximum deceleration shall be regarded.

Definition at line 1492 of file MSVehicle.h.

Referenced by getSpeedMode(), influenceSpeed(), and setSpeedMode().

◆ myConsiderSafeVelocity

bool MSVehicle::Influencer::myConsiderSafeVelocity
private

Whether the safe velocity shall be regarded.

Definition at line 1486 of file MSVehicle.h.

Referenced by getSpeedMode(), influenceSpeed(), and setSpeedMode().

◆ myCooperativeLC

LaneChangeMode MSVehicle::Influencer::myCooperativeLC
private

lane changing with the intent to help other vehicles

Definition at line 1514 of file MSVehicle.h.

Referenced by getLanechangeMode(), influenceChangeDecision(), and setLaneChangeMode().

◆ myEmergencyBrakeRedLight

bool MSVehicle::Influencer::myEmergencyBrakeRedLight
private

Whether red lights are a reason to brake.

Definition at line 1498 of file MSVehicle.h.

Referenced by getSpeedMode(), and setSpeedMode().

◆ myLaneTimeLine

std::vector<std::pair<SUMOTime, int> > MSVehicle::Influencer::myLaneTimeLine
private

The lane usage time line to apply.

Definition at line 1474 of file MSVehicle.h.

Referenced by changeRequestRemainingSeconds(), influenceChangeDecision(), and setLaneTimeLine().

◆ myLastRemoteAccess

SUMOTime MSVehicle::Influencer::myLastRemoteAccess
private

Definition at line 1507 of file MSVehicle.h.

Referenced by isRemoteAffected(), isRemoteControlled(), and setRemoteControlled().

◆ myLatDist

double MSVehicle::Influencer::myLatDist
private

The requested lateral change.

Definition at line 1480 of file MSVehicle.h.

Referenced by influenceChangeDecision(), and setSublaneChange().

◆ myOriginalSpeed

double MSVehicle::Influencer::myOriginalSpeed
private

The velocity before influence.

Definition at line 1477 of file MSVehicle.h.

Referenced by getOriginalSpeed(), and influenceSpeed().

◆ myRemoteAngle

double MSVehicle::Influencer::myRemoteAngle
private

Definition at line 1504 of file MSVehicle.h.

Referenced by postProcessRemoteControl(), and setRemoteControlled().

◆ myRemoteEdgeOffset

int MSVehicle::Influencer::myRemoteEdgeOffset
private

Definition at line 1505 of file MSVehicle.h.

Referenced by postProcessRemoteControl(), and setRemoteControlled().

◆ myRemoteLane

MSLane* MSVehicle::Influencer::myRemoteLane
private

◆ myRemotePos

double MSVehicle::Influencer::myRemotePos
private

◆ myRemotePosLat

double MSVehicle::Influencer::myRemotePosLat
private

Definition at line 1503 of file MSVehicle.h.

Referenced by postProcessRemoteControl(), and setRemoteControlled().

◆ myRemoteRoute

ConstMSEdgeVector MSVehicle::Influencer::myRemoteRoute
private

Definition at line 1506 of file MSVehicle.h.

Referenced by postProcessRemoteControl(), and setRemoteControlled().

◆ myRemoteXYPos

Position MSVehicle::Influencer::myRemoteXYPos
private

◆ myRespectJunctionPriority

bool MSVehicle::Influencer::myRespectJunctionPriority
private

Whether the junction priority rules are respected.

Definition at line 1495 of file MSVehicle.h.

Referenced by getSpeedMode(), and setSpeedMode().

◆ myRightDriveLC

LaneChangeMode MSVehicle::Influencer::myRightDriveLC
private

changing to the rightmost lane

Definition at line 1518 of file MSVehicle.h.

Referenced by getLanechangeMode(), influenceChangeDecision(), and setLaneChangeMode().

◆ myRoutingMode

int MSVehicle::Influencer::myRoutingMode
private

routing mode (see TraCIConstants.h)

Definition at line 1529 of file MSVehicle.h.

Referenced by getRouterTT().

◆ mySpeedAdaptationStarted

bool MSVehicle::Influencer::mySpeedAdaptationStarted
private

Whether influencing the speed has already started.

Definition at line 1483 of file MSVehicle.h.

Referenced by influenceSpeed(), and setSpeedTimeLine().

◆ mySpeedGainLC

LaneChangeMode MSVehicle::Influencer::mySpeedGainLC
private

lane changing to travel with higher speed

Definition at line 1516 of file MSVehicle.h.

Referenced by getLanechangeMode(), influenceChangeDecision(), and setLaneChangeMode().

◆ mySpeedTimeLine

std::vector<std::pair<SUMOTime, double> > MSVehicle::Influencer::mySpeedTimeLine
private

The velocity time line to apply.

Definition at line 1471 of file MSVehicle.h.

Referenced by getOriginalSpeed(), influenceSpeed(), and setSpeedTimeLine().

◆ myStrategicLC

LaneChangeMode MSVehicle::Influencer::myStrategicLC
private

lane changing which is necessary to follow the current route

Definition at line 1512 of file MSVehicle.h.

Referenced by getLanechangeMode(), influenceChangeDecision(), and setLaneChangeMode().

◆ mySublaneLC

LaneChangeMode MSVehicle::Influencer::mySublaneLC
private

changing to the prefered lateral alignment

Definition at line 1520 of file MSVehicle.h.

Referenced by getLanechangeMode(), influenceChangeDecision(), and setLaneChangeMode().

◆ myTraciLaneChangePriority

TraciLaneChangePriority MSVehicle::Influencer::myTraciLaneChangePriority
private

flags for determining the priority of traci lane change requests

Definition at line 1523 of file MSVehicle.h.

Referenced by getLanechangeMode(), influenceChangeDecision(), and setLaneChangeMode().

◆ myTraCISignals

int MSVehicle::Influencer::myTraCISignals
private

Definition at line 1526 of file MSVehicle.h.


The documentation for this class was generated from the following files: