SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSVehicle::Influencer Class Reference

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

#include <MSVehicle.h>

Collaboration diagram for MSVehicle::Influencer:
Collaboration graph

Public Member Functions

SUMOReal 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...
 
SUMOTime getLastAccessTimeStep () const
 
SUMOReal getOriginalSpeed () const
 Returns the originally longitudinal speed to use. More...
 
bool getRespectJunctionPriority () const
 Returns whether junction priority rules shall be respected. More...
 
int getSpeedMode () const
 return the current speed mode More...
 
SUMOReal implicitDeltaPosVTD (const MSVehicle *veh)
 return the change in longitudinal position that is implicit in the new VTD position More...
 
SUMOReal implicitSpeedVTD (const MSVehicle *veh, SUMOReal oldSpeed)
 return the speed that is implicit in the new VTD 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...
 
SUMOReal influenceSpeed (SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax)
 Applies stored velocity information on the speed to use. More...
 
bool isVTDAffected (SUMOTime t) const
 
bool isVTDControlled () const
 
void postProcessVTD (MSVehicle *v)
 
void setConsiderMaxAcceleration (bool value)
 Sets whether the maximum acceleration shall be regarded. More...
 
void setConsiderMaxDeceleration (bool value)
 Sets whether the maximum deceleration shall be regarded. More...
 
void setConsiderSafeVelocity (bool value)
 Sets whether the safe velocity shall be regarded. More...
 
void setEmergencyBrakeRedLight (bool value)
 Sets whether red lights shall be a reason to brake. More...
 
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 setRespectJunctionPriority (bool value)
 Sets whether junction priority rules shall be respected. More...
 
void setSpeedTimeLine (const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
 Sets a new velocity timeline. More...
 
void setVTDControlled (Position xyPos, MSLane *l, SUMOReal pos, SUMOReal posLat, SUMOReal angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
 
 ~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 myLastVTDAccess
 
SUMOReal myOriginalSpeed
 The velocity before influence. More...
 
bool myRespectJunctionPriority
 Whether the junction priority rules are respected. More...
 
bool mySpeedAdaptationStarted
 Whether influencing the speed has already started. More...
 
std::vector< std::pair
< SUMOTime, SUMOReal > > 
mySpeedTimeLine
 The velocity time line to apply. More...
 
TraciLaneChangePriority myTraciLaneChangePriority
 flags for determining the priority of traci lane change requests More...
 
SUMOReal myVTDAngle
 
int myVTDEdgeOffset
 
MSLanemyVTDLane
 
SUMOReal myVTDPos
 
SUMOReal myVTDPosLat
 
ConstMSEdgeVector myVTDRoute
 
Position myVTDXYPos
 
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 1163 of file MSVehicle.h.

Constructor & Destructor Documentation

MSVehicle::Influencer::Influencer ( )

Constructor.

Definition at line 235 of file MSVehicle.cpp.

MSVehicle::Influencer::~Influencer ( )

Destructor.

Definition at line 252 of file MSVehicle.cpp.

Member Function Documentation

SUMOReal 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 396 of file MSVehicle.cpp.

References STEPS2TIME.

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

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 1258 of file MSVehicle.h.

References myEmergencyBrakeRedLight.

Referenced by MSVehicle::executeMove().

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

Definition at line 1278 of file MSVehicle.h.

References myLastVTDAccess.

SUMOReal MSVehicle::Influencer::getOriginalSpeed ( ) const
inline

Returns the originally longitudinal speed to use.

Returns
The speed given before influence

Definition at line 1272 of file MSVehicle.h.

References myOriginalSpeed.

Referenced by MSVehicle::getSpeedWithoutTraciInfluence().

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

Returns whether junction priority rules shall be respected.

Returns
Whether junction priority rules be respected

Definition at line 1244 of file MSVehicle.h.

References myRespectJunctionPriority.

Referenced by MSVehicle::checkRewindLinkLanes(), and MSVehicle::executeMove().

int MSVehicle::Influencer::getSpeedMode ( ) const

return the current speed mode

Definition at line 269 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processGet().

SUMOReal MSVehicle::Influencer::implicitDeltaPosVTD ( const MSVehicle veh)

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

Definition at line 513 of file MSVehicle.cpp.

References DIST2SPEED, Position::distanceTo2D(), MSVehicle::getDistanceToPosition(), MSBaseVehicle::getMaxSpeed(), MSVehicle::getPosition(), and SUMOReal.

Referenced by MSVehicle::updateState().

SUMOReal MSVehicle::Influencer::implicitSpeedVTD ( const MSVehicle veh,
SUMOReal  oldSpeed 
)

return the speed that is implicit in the new VTD position

Definition at line 498 of file MSVehicle.cpp.

References DIST2SPEED, Position::distanceTo2D(), MSVehicle::getDistanceToPosition(), MSBaseVehicle::getMaxSpeed(), MSVehicle::getPosition(), and SUMOReal.

Referenced by MSVehicle::executeMove().

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 312 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, MSVehicle::REQUEST_HOLD, MSVehicle::REQUEST_LEFT, MSVehicle::REQUEST_NONE, MSVehicle::REQUEST_RIGHT, time2string(), toString(), and WRITE_WARNING.

Referenced by MSVehicle::influenceChangeDecision().

SUMOReal MSVehicle::Influencer::influenceSpeed ( SUMOTime  currentTime,
SUMOReal  speed,
SUMOReal  vSafe,
SUMOReal  vMin,
SUMOReal  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 279 of file MSVehicle.cpp.

References DELTA_T, MAX2(), MIN2(), STEPS2TIME, and SUMOReal.

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

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

Definition at line 464 of file MSVehicle.cpp.

References TIME2STEPS.

Referenced by MSLane::detectCollisionBetween(), and MSLane::handleCollisionBetween().

bool MSVehicle::Influencer::isVTDControlled ( ) const
void MSVehicle::Influencer::setConsiderMaxAcceleration ( bool  value)

Sets whether the maximum acceleration shall be regarded.

Parameters
[in]valueWhether the maximum acceleration shall be regarded

Definition at line 410 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::Influencer::setConsiderMaxDeceleration ( bool  value)

Sets whether the maximum deceleration shall be regarded.

Parameters
[in]valueWhether the maximum deceleration shall be regarded

Definition at line 416 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::Influencer::setConsiderSafeVelocity ( bool  value)

Sets whether the safe velocity shall be regarded.

Parameters
[in]valueWhether the safe velocity shall be regarded

Definition at line 404 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::Influencer::setEmergencyBrakeRedLight ( bool  value)

Sets whether red lights shall be a reason to brake.

Parameters
[in]valueWhether red lights shall be a reason to brake

Definition at line 428 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

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

Sets lane changing behavior.

Parameters
[in]valuea bitset controlling the different modes

Definition at line 434 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

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 263 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::Influencer::setRespectJunctionPriority ( bool  value)

Sets whether junction priority rules shall be respected.

Parameters
[in]valueWhether junction priority rules be respected

Definition at line 422 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

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

Sets a new velocity timeline.

Parameters
[in]speedTimeLineThe time line of speeds to use

Definition at line 256 of file MSVehicle.cpp.

Referenced by TraCIServerAPI_Vehicle::processSet().

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

Definition at line 445 of file MSVehicle.cpp.

Referenced by TraCIServer::setVTDControlled().

Field Documentation

bool MSVehicle::Influencer::myConsiderMaxAcceleration
private

Whether the maximum acceleration shall be regarded.

Definition at line 1311 of file MSVehicle.h.

bool MSVehicle::Influencer::myConsiderMaxDeceleration
private

Whether the maximum deceleration shall be regarded.

Definition at line 1314 of file MSVehicle.h.

bool MSVehicle::Influencer::myConsiderSafeVelocity
private

Whether the safe velocity shall be regarded.

Definition at line 1308 of file MSVehicle.h.

LaneChangeMode MSVehicle::Influencer::myCooperativeLC
private

lane changing with the intent to help other vehicles

Definition at line 1336 of file MSVehicle.h.

bool MSVehicle::Influencer::myEmergencyBrakeRedLight
private

Whether red lights are a reason to brake.

Definition at line 1320 of file MSVehicle.h.

Referenced by getEmergencyBrakeRedLight().

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

The lane usage time line to apply.

Definition at line 1299 of file MSVehicle.h.

SUMOTime MSVehicle::Influencer::myLastVTDAccess
private

Definition at line 1329 of file MSVehicle.h.

Referenced by getLastAccessTimeStep().

SUMOReal MSVehicle::Influencer::myOriginalSpeed
private

The velocity before influence.

Definition at line 1302 of file MSVehicle.h.

Referenced by getOriginalSpeed().

bool MSVehicle::Influencer::myRespectJunctionPriority
private

Whether the junction priority rules are respected.

Definition at line 1317 of file MSVehicle.h.

Referenced by getRespectJunctionPriority().

LaneChangeMode MSVehicle::Influencer::myRightDriveLC
private

changing to the rightmost lane

Definition at line 1340 of file MSVehicle.h.

bool MSVehicle::Influencer::mySpeedAdaptationStarted
private

Whether influencing the speed has already started.

Definition at line 1305 of file MSVehicle.h.

LaneChangeMode MSVehicle::Influencer::mySpeedGainLC
private

lane changing to travel with higher speed

Definition at line 1338 of file MSVehicle.h.

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

The velocity time line to apply.

Definition at line 1296 of file MSVehicle.h.

LaneChangeMode MSVehicle::Influencer::myStrategicLC
private

lane changing which is necessary to follow the current route

Definition at line 1334 of file MSVehicle.h.

LaneChangeMode MSVehicle::Influencer::mySublaneLC
private

changing to the prefered lateral alignment

Definition at line 1342 of file MSVehicle.h.

TraciLaneChangePriority MSVehicle::Influencer::myTraciLaneChangePriority
private

flags for determining the priority of traci lane change requests

Definition at line 1345 of file MSVehicle.h.

SUMOReal MSVehicle::Influencer::myVTDAngle
private

Definition at line 1326 of file MSVehicle.h.

int MSVehicle::Influencer::myVTDEdgeOffset
private

Definition at line 1327 of file MSVehicle.h.

MSLane* MSVehicle::Influencer::myVTDLane
private

Definition at line 1323 of file MSVehicle.h.

SUMOReal MSVehicle::Influencer::myVTDPos
private

Definition at line 1324 of file MSVehicle.h.

SUMOReal MSVehicle::Influencer::myVTDPosLat
private

Definition at line 1325 of file MSVehicle.h.

ConstMSEdgeVector MSVehicle::Influencer::myVTDRoute
private

Definition at line 1328 of file MSVehicle.h.

Position MSVehicle::Influencer::myVTDXYPos
private

Definition at line 1322 of file MSVehicle.h.


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