![]() |
Eclipse SUMO - Simulation of Urban MObility
|
Changes the wished vehicle speed / lanes. More...
#include <MSVehicle.h>
Data Structures | |
struct | GapControlState |
Container for state and parameters of the gap control. More... | |
class | GapControlVehStateListener |
A static instance of this class in GapControlState deactivates gap control for vehicles whose reference vehicle is removed from the road network. More... | |
Public Member Functions | |
void | activateGapController (double originalTau, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, MSVehicle *refVeh=nullptr) |
Activates the gap control with the given parameters,. More... | |
void | adaptLaneTimeLine (int indexShift) |
Adapts lane timeline when moving to a new lane and the lane index changes. More... | |
double | changeRequestRemainingSeconds (const SUMOTime currentTime) const |
Return the remaining number of seconds of the current laneTimeLine assuming one exists. More... | |
bool | considerSafeVelocity () const |
Returns whether safe velocities shall be considered. More... | |
void | deactivateGapController () |
Deactivates the gap control. More... | |
double | gapControlSpeed (SUMOTime currentTime, const SUMOVehicle *veh, double speed, double vSafe, double vMin, double vMax) |
Applies gap control logic on the speed. 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 | getLaneTimeLineDuration () |
SUMOTime | getLaneTimeLineEnd () |
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 rngIndex) const |
int | getRoutingMode () const |
return the current routing mode More... | |
int | getSignals () const |
int | getSpeedMode () const |
return the current speed mode More... | |
bool | ignoreOverlap () const |
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 ¤tEdge, 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... | |
Static Public Member Functions | |
static void | cleanup () |
Static cleanup. More... | |
static void | init () |
Static initalization. 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::shared_ptr< GapControlState > | myGapControlState |
The gap control state. 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 |
MSLane * | myRemoteLane |
double | myRemotePos |
double | myRemotePosLat |
ConstMSEdgeVector | myRemoteRoute |
Position | myRemoteXYPos |
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, double > > | mySpeedTimeLine |
The velocity time line to apply. More... | |
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... | |
TraciLaneChangePriority | myTraciLaneChangePriority |
flags for determining the priority of traci lane change requests More... | |
int | myTraCISignals |
int | myRoutingMode |
routing mode (see TraCIConstants.h) More... | |
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 1455 of file MSVehicle.h.
MSVehicle::Influencer::Influencer | ( | ) |
Constructor.
Definition at line 351 of file MSVehicle.cpp.
MSVehicle::Influencer::~Influencer | ( | ) |
Destructor.
Definition at line 373 of file MSVehicle.cpp.
void MSVehicle::Influencer::activateGapController | ( | double | originalTau, |
double | newTimeHeadway, | ||
double | newSpaceHeadway, | ||
double | duration, | ||
double | changeRate, | ||
double | maxDecel, | ||
MSVehicle * | refVeh = nullptr |
||
) |
Activates the gap control with the given parameters,.
Definition at line 392 of file MSVehicle.cpp.
Referenced by libsumo::Vehicle::openGap(), and MSDevice_ToC::requestToC().
void MSVehicle::Influencer::adaptLaneTimeLine | ( | int | indexShift | ) |
Adapts lane timeline when moving to a new lane and the lane index changes.
[in] | indexShift | The change in laneIndex |
Definition at line 413 of file MSVehicle.cpp.
Referenced by MSVehicle::enterLaneAtMove().
double MSVehicle::Influencer::changeRequestRemainingSeconds | ( | const SUMOTime | currentTime | ) | const |
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
[in] | currentTime | The current simulation time |
Definition at line 749 of file MSVehicle.cpp.
References STEPS2TIME.
Referenced by MSLCM_LC2013::_wantsChange(), and MSLCM_SL2015::_wantsChangeSublane().
|
static |
|
inline |
Returns whether safe velocities shall be considered.
Definition at line 1634 of file MSVehicle.h.
References myConsiderSafeVelocity.
Referenced by MSVehicle::planMoveInternal().
void MSVehicle::Influencer::deactivateGapController | ( | ) |
Deactivates the gap control.
Definition at line 400 of file MSVehicle.cpp.
Referenced by libsumo::Vehicle::deactivateGapControl(), and MSDevice_ToC::setState().
double MSVehicle::Influencer::gapControlSpeed | ( | SUMOTime | currentTime, |
const SUMOVehicle * | veh, | ||
double | speed, | ||
double | vSafe, | ||
double | vMin, | ||
double | vMax | ||
) |
Applies gap control logic on the speed.
The given speed is assumed to be the non-influenced speed from longitudinal control. It is stored for further usage in "myOriginalSpeed".
[in] | currentTime | The current simulation time |
[in] | veh | The controlled vehicle |
[in] | speed | The undisturbed speed |
[in] | vSafe | The safe velocity |
[in] | vMin | The minimum velocity |
[in] | vMax | The maximum simulation time |
Definition at line 501 of file MSVehicle.cpp.
References DEBUG_COND2, MSCFModel::followSpeed(), MSVehicleType::getCarFollowModel(), MSVehicle::getDistanceToPosition(), MSBaseVehicle::getEdge(), MSCFModel::getHeadwayTime(), MSVehicle::getLeader(), MSBaseVehicle::getLength(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), SUMOTrafficObject::getSpeed(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MAX2(), MIN2(), POSITION_EPS, MSCFModel::setHeadwayTime(), and TS.
Referenced by MSVehicle::planMoveInternal().
|
inline |
Returns whether red lights shall be a reason to brake.
Definition at line 1628 of file MSVehicle.h.
References myEmergencyBrakeRedLight.
Referenced by MSVehicle::ignoreRed(), and MSVehicle::processLaneAdvances().
int MSVehicle::Influencer::getLaneChangeMode | ( | ) | const |
return the current lane change mode
Definition at line 436 of file MSVehicle.cpp.
Referenced by MSDevice_ToC::deactivateDeliberateLCs(), and libsumo::Vehicle::getLaneChangeMode().
SUMOTime MSVehicle::Influencer::getLaneTimeLineDuration | ( | ) |
Definition at line 446 of file MSVehicle.cpp.
Referenced by MSLaneChanger::changeOpposite().
SUMOTime MSVehicle::Influencer::getLaneTimeLineEnd | ( | ) |
Definition at line 459 of file MSVehicle.cpp.
|
inline |
Definition at line 1662 of file MSVehicle.h.
References myLastRemoteAccess.
Referenced by MSVehicle::wasRemoteControlled().
|
inline |
Definition at line 1686 of file MSVehicle.h.
References myLatDist.
Referenced by MSLCM_SL2015::checkBlocking(), MSAbstractLaneChangeModel::checkTraCICommands(), and MSLCM_SL2015::keepLatGap().
double MSVehicle::Influencer::getOriginalSpeed | ( | ) | const |
Returns the originally longitudinal speed to use.
Definition at line 648 of file MSVehicle.cpp.
Referenced by MSVehicle::getSpeedWithoutTraciInfluence().
|
inline |
Returns whether junction priority rules shall be respected.
Definition at line 1620 of file MSVehicle.h.
References myRespectJunctionPriority.
Referenced by MSLaneChanger::changeOpposite(), MSVehicle::checkRewindLinkLanes(), and MSVehicle::processLinkApproaches().
SUMOAbstractRouter< MSEdge, SUMOVehicle > & MSVehicle::Influencer::getRouterTT | ( | const int | rngIndex | ) | const |
Definition at line 901 of file MSVehicle.cpp.
References MSNet::getInstance(), MSRoutingEngine::getRouterTT(), and MSNet::getRouterTT().
Referenced by libsumo::Vehicle::changeTarget(), MSVehicle::rerouteParkingArea(), and libsumo::Vehicle::rerouteTraveltime().
|
inline |
return the current routing mode
Definition at line 1566 of file MSVehicle.h.
References myRoutingMode.
Referenced by libsumo::Vehicle::getRoutingMode().
|
inline |
Definition at line 1682 of file MSVehicle.h.
References myTraCISignals.
Referenced by MSVehicle::setBlinkerInformation().
int MSVehicle::Influencer::getSpeedMode | ( | ) | const |
return the current speed mode
Definition at line 426 of file MSVehicle.cpp.
Referenced by libsumo::Vehicle::getSpeedMode().
|
inline |
Definition at line 1694 of file MSVehicle.h.
References MSVehicle::LCP_ALWAYS, and myTraciLaneChangePriority.
Referenced by MSLCM_SL2015::checkBlocking().
double MSVehicle::Influencer::implicitDeltaPosRemote | ( | const MSVehicle * | veh | ) |
return the change in longitudinal position that is implicit in the new remote position
Definition at line 880 of file MSVehicle.cpp.
References DIST2SPEED, Position::distanceTo2D(), MSVehicle::getDistanceToPosition(), MSBaseVehicle::getMaxSpeed(), and MSVehicle::getPosition().
Referenced by MSVehicle::updateState().
double MSVehicle::Influencer::implicitSpeedRemote | ( | const MSVehicle * | veh, |
double | oldSpeed | ||
) |
return the speed that is implicit in the new remote position
Definition at line 853 of file MSVehicle.cpp.
References DIST2SPEED, Position::distanceTo2D(), MSVehicle::getCarFollowModel(), MSVehicle::getDistanceToPosition(), MSVehicle::getLane(), MSVehicleType::getMaxSpeed(), MSVehicle::getPosition(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), Position::INVALID, MAX2(), MIN2(), and MSCFModel::minNextSpeedEmergency().
Referenced by MSVehicle::processTraCISpeedControl().
int MSVehicle::Influencer::influenceChangeDecision | ( | const SUMOTime | currentTime, |
const MSEdge & | currentEdge, | ||
const int | currentLaneIndex, | ||
int | state | ||
) |
Applies stored LaneChangeMode information and laneTimeLine.
[in] | currentTime | The current simulation time |
[in] | currentEdge | The current edge the vehicle is on |
[in] | currentLaneIndex | The index of the lane the vehicle is currently on |
[in] | state | The LaneChangeAction flags as computed by the laneChangeModel |
Definition at line 654 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().
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".
[in] | currentTime | The current simulation time |
[in] | speed | The undisturbed speed |
[in] | vSafe | The safe velocity |
[in] | vMin | The minimum velocity |
[in] | vMax | The maximum simulation time |
Definition at line 469 of file MSVehicle.cpp.
References DELTA_T, MAX2(), MIN2(), and STEPS2TIME.
Referenced by MSVehicle::planMoveInternal(), and MSVehicle::processTraCISpeedControl().
|
static |
Static initalization.
Definition at line 376 of file MSVehicle.cpp.
Referenced by MSNet::initStatic().
bool MSVehicle::Influencer::isRemoteAffected | ( | SUMOTime | t | ) | const |
Definition at line 797 of file MSVehicle.cpp.
References TIME2STEPS.
Referenced by MSLane::detectCollisionBetween(), MSVehicle::getPosition(), and MSLane::handleCollisionBetween().
bool MSVehicle::Influencer::isRemoteControlled | ( | ) | const |
Definition at line 791 of file MSVehicle.cpp.
References MSNet::getCurrentTimeStep(), and MSNet::getInstance().
Referenced by MSVehicle::isRemoteControlled(), MSVehicle::processTraCISpeedControl(), and MSVehicle::updateState().
void MSVehicle::Influencer::postProcessRemoteControl | ( | MSVehicle * | v | ) |
Definition at line 802 of file MSVehicle.cpp.
References MSRoute::begin(), MSVehicle::drawOutsideNetwork(), GeomHelper::fromNaviDegree(), MSBaseVehicle::getDeparture(), MSVehicle::getLane(), MSVehicleType::getMaxSpeed(), MSBaseVehicle::getRoute(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSVehicleType::getWidth(), MSVehicle::isOnRoad(), MSVehicle::myAcceleration, MSBaseVehicle::myCurrEdge, MSVehicle::State::myPos, MSVehicle::State::myPosLat, MSVehicle::State::myPreviousSpeed, MSVehicle::State::mySpeed, MSVehicle::myState, MSBaseVehicle::NOT_YET_DEPARTED, MSMoveReminder::NOTIFICATION_DEPARTED, MSMoveReminder::NOTIFICATION_TELEPORT, MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED, MSBaseVehicle::onDepart(), MSVehicle::onRemovalFromNet(), MSVehicle::processTraCISpeedControl(), MSLane::removeVehicle(), MSBaseVehicle::replaceRouteEdges(), MSVehicle::setAngle(), MSVehicle::setBrakingSignals(), MSVehicle::setRemoteState(), SPEED2ACCEL, MSVehicle::updateBestLanes(), and MSVehicle::updateWaitingTime().
|
inline |
Definition at line 1690 of file MSVehicle.h.
References myLatDist.
Referenced by MSAbstractLaneChangeModel::checkTraCICommands().
void MSVehicle::Influencer::setLaneChangeMode | ( | int | value | ) |
Sets lane changing behavior.
[in] | value | a bitset controlling the different modes |
Definition at line 767 of file MSVehicle.cpp.
Referenced by MSDevice_ToC::deactivateDeliberateLCs(), MSDevice_Bluelight::notifyMove(), MSDevice_ToC::resetDeliberateLCs(), and libsumo::Vehicle::setLaneChangeMode().
void MSVehicle::Influencer::setLaneTimeLine | ( | const std::vector< std::pair< SUMOTime, int > > & | laneTimeLine | ) |
Sets a new lane timeline.
[in] | laneTimeLine | The time line of lanes to use |
Definition at line 407 of file MSVehicle.cpp.
Referenced by libsumo::Vehicle::changeLane(), libsumo::Vehicle::changeLaneRelative(), and MSDevice_ToC::MRMExecutionStep().
void MSVehicle::Influencer::setRemoteControlled | ( | Position | xyPos, |
MSLane * | l, | ||
double | pos, | ||
double | posLat, | ||
double | angle, | ||
int | edgeOffset, | ||
const ConstMSEdgeVector & | route, | ||
SUMOTime | t | ||
) |
Definition at line 778 of file MSVehicle.cpp.
Referenced by libsumo::Helper::setRemoteControlled().
|
inline |
Sets routing behavior.
[in] | value | an enum value controlling the different modes |
Definition at line 1651 of file MSVehicle.h.
References myRoutingMode.
Referenced by libsumo::Vehicle::setRoutingMode().
|
inline |
Definition at line 1678 of file MSVehicle.h.
References myTraCISignals.
Referenced by MSVehicle::setBlinkerInformation(), and libsumo::Vehicle::setSignals().
void MSVehicle::Influencer::setSpeedMode | ( | int | speedMode | ) |
Sets speed-constraining behaviors.
[in] | value | a bitset controlling the different modes |
Definition at line 757 of file MSVehicle.cpp.
Referenced by MSDevice_Bluelight::notifyMove(), MSCFModel_CC::setParameter(), and libsumo::Vehicle::setSpeedMode().
void MSVehicle::Influencer::setSpeedTimeLine | ( | const std::vector< std::pair< SUMOTime, double > > & | speedTimeLine | ) |
Sets a new velocity timeline.
[in] | speedTimeLine | The time line of speeds to use |
Definition at line 386 of file MSVehicle.cpp.
Referenced by MSDevice_ToC::MRMExecutionStep(), MSDevice_Bluelight::notifyMove(), libsumo::Vehicle::setSpeed(), and libsumo::Vehicle::slowDown().
void MSVehicle::Influencer::setSublaneChange | ( | double | latDist | ) |
Sets a new sublane-change request.
[in] | latDist | The lateral distance for changing |
Definition at line 421 of file MSVehicle.cpp.
Referenced by libsumo::Vehicle::changeSublane(), and MSLaneChangerSublane::startChangeSublane().
|
private |
Whether the maximum acceleration shall be regarded.
Definition at line 1723 of file MSVehicle.h.
|
private |
Whether the maximum deceleration shall be regarded.
Definition at line 1726 of file MSVehicle.h.
|
private |
Whether the safe velocity shall be regarded.
Definition at line 1720 of file MSVehicle.h.
Referenced by considerSafeVelocity().
|
private |
lane changing with the intent to help other vehicles
Definition at line 1748 of file MSVehicle.h.
|
private |
Whether red lights are a reason to brake.
Definition at line 1732 of file MSVehicle.h.
Referenced by getEmergencyBrakeRedLight().
|
private |
The gap control state.
Definition at line 1708 of file MSVehicle.h.
|
private |
The lane usage time line to apply.
Definition at line 1705 of file MSVehicle.h.
|
private |
Definition at line 1741 of file MSVehicle.h.
Referenced by getLastAccessTimeStep().
|
private |
The requested lateral change.
Definition at line 1714 of file MSVehicle.h.
Referenced by getLatDist(), and resetLatDist().
|
private |
The velocity before influence.
Definition at line 1711 of file MSVehicle.h.
|
private |
Definition at line 1738 of file MSVehicle.h.
|
private |
Definition at line 1739 of file MSVehicle.h.
|
private |
Definition at line 1735 of file MSVehicle.h.
|
private |
Definition at line 1736 of file MSVehicle.h.
|
private |
Definition at line 1737 of file MSVehicle.h.
|
private |
Definition at line 1740 of file MSVehicle.h.
|
private |
Definition at line 1734 of file MSVehicle.h.
|
private |
Whether the junction priority rules are respected.
Definition at line 1729 of file MSVehicle.h.
Referenced by getRespectJunctionPriority().
|
private |
changing to the rightmost lane
Definition at line 1752 of file MSVehicle.h.
|
private |
routing mode (see TraCIConstants.h)
Definition at line 1763 of file MSVehicle.h.
Referenced by getRoutingMode(), and setRoutingMode().
|
private |
Whether influencing the speed has already started.
Definition at line 1717 of file MSVehicle.h.
|
private |
lane changing to travel with higher speed
Definition at line 1750 of file MSVehicle.h.
|
private |
The velocity time line to apply.
Definition at line 1702 of file MSVehicle.h.
|
private |
lane changing which is necessary to follow the current route
Definition at line 1746 of file MSVehicle.h.
|
private |
changing to the prefered lateral alignment
Definition at line 1754 of file MSVehicle.h.
|
private |
flags for determining the priority of traci lane change requests
Definition at line 1757 of file MSVehicle.h.
Referenced by ignoreOverlap().
|
private |
Definition at line 1760 of file MSVehicle.h.
Referenced by getSignals(), and setSignals().