![]() |
SUMO - Simulation of Urban MObility
|
Changes the wished vehicle speed / lanes. More...
#include <MSVehicle.h>
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 ¤tEdge, 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 |
MSLane * | myVTDLane |
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... | |
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 1105 of file MSVehicle.h.
MSVehicle::Influencer::Influencer | ( | ) |
Constructor.
Definition at line 225 of file MSVehicle.cpp.
MSVehicle::Influencer::~Influencer | ( | ) |
Destructor.
Definition at line 242 of file MSVehicle.cpp.
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
[in] | currentTime | The current simulation time |
Definition at line 386 of file MSVehicle.cpp.
References myLaneTimeLine, and STEPS2TIME.
Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), and MSLCM_SL2015::_wantsChangeSublane().
|
inline |
Returns whether red lights shall be a reason to brake.
Definition at line 1200 of file MSVehicle.h.
Referenced by MSVehicle::executeMove().
|
inline |
Definition at line 1220 of file MSVehicle.h.
References SUMOReal.
|
inline |
Returns the originally longitudinal speed to use.
Definition at line 1214 of file MSVehicle.h.
References SUMOReal.
Referenced by MSVehicle::getSpeedWithoutTraciInfluence().
|
inline |
Returns whether junction priority rules shall be respected.
Definition at line 1186 of file MSVehicle.h.
Referenced by MSVehicle::checkRewindLinkLanes(), and MSVehicle::executeMove().
int MSVehicle::Influencer::getSpeedMode | ( | ) | const |
return the current speed mode
Definition at line 259 of file MSVehicle.cpp.
References myConsiderMaxAcceleration, myConsiderMaxDeceleration, myConsiderSafeVelocity, myEmergencyBrakeRedLight, myRespectJunctionPriority, and SUMOReal.
Referenced by TraCIServerAPI_Vehicle::processGet().
return the change in longitudinal position that is implicit in the new VTD position
Definition at line 503 of file MSVehicle.cpp.
References DIST2SPEED, Position::distanceTo2D(), MSVehicle::getDistanceToPosition(), MSLane::getEdge(), MSBaseVehicle::getMaxSpeed(), MSVehicle::getPosition(), myVTDLane, myVTDPos, myVTDXYPos, and SUMOReal.
Referenced by MSVehicle::executeMove().
return the speed that is implicit in the new VTD position
Definition at line 488 of file MSVehicle.cpp.
References DIST2SPEED, Position::distanceTo2D(), MSVehicle::getDistanceToPosition(), MSLane::getEdge(), MSBaseVehicle::getMaxSpeed(), MSVehicle::getPosition(), myVTDLane, myVTDPos, myVTDXYPos, 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.
[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 302 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, myRightDriveLC, mySpeedGainLC, myStrategicLC, mySublaneLC, myTraciLaneChangePriority, MSVehicle::REQUEST_HOLD, MSVehicle::REQUEST_LEFT, MSVehicle::REQUEST_NONE, MSVehicle::REQUEST_RIGHT, SUMOReal, 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".
[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 269 of file MSVehicle.cpp.
References DELTA_T, MAX2(), MIN2(), myConsiderMaxAcceleration, myConsiderMaxDeceleration, myConsiderSafeVelocity, myOriginalSpeed, mySpeedAdaptationStarted, mySpeedTimeLine, STEPS2TIME, and SUMOReal.
Referenced by MSVehicle::executeMove(), and MSVehicle::planMoveInternal().
bool MSVehicle::Influencer::isVTDAffected | ( | SUMOTime | t | ) | const |
Definition at line 454 of file MSVehicle.cpp.
References myLastVTDAccess, and TIME2STEPS.
Referenced by MSLane::detectCollisionBetween(), and MSLane::handleCollisionBetween().
bool MSVehicle::Influencer::isVTDControlled | ( | ) | const |
Definition at line 448 of file MSVehicle.cpp.
References MSNet::getCurrentTimeStep(), MSNet::getInstance(), and myLastVTDAccess.
Referenced by MSVehicle::executeMove(), MSLane::executeMovements(), and MSVehicle::isRemoteControlled().
void MSVehicle::Influencer::postProcessVTD | ( | MSVehicle * | v | ) |
Definition at line 459 of file MSVehicle.cpp.
References MSRoute::begin(), DEG2RAD, MSVehicle::drawOutsideNetwork(), MSLane::forceVehicleInsertion(), MSVehicle::getLane(), MSLane::getLength(), MSBaseVehicle::getRoute(), MSBaseVehicle::getVehicleType(), MSVehicleType::getWidth(), MSLane::getWidth(), MSVehicle::isOnRoad(), M_PI, MSBaseVehicle::myCurrEdge, myVTDAngle, myVTDEdgeOffset, myVTDLane, myVTDPos, myVTDPosLat, myVTDRoute, myVTDXYPos, MSMoveReminder::NOTIFICATION_TELEPORT, MSVehicle::onRemovalFromNet(), MSLane::removeVehicle(), MSBaseVehicle::replaceRouteEdges(), MSVehicle::setAngle(), MSVehicle::setVTDState(), SUMOReal, and MSVehicle::updateBestLanes().
void MSVehicle::Influencer::setConsiderMaxAcceleration | ( | bool | value | ) |
Sets whether the maximum acceleration shall be regarded.
[in] | value | Whether the maximum acceleration shall be regarded |
Definition at line 400 of file MSVehicle.cpp.
References myConsiderMaxAcceleration.
Referenced by TraCIServerAPI_Vehicle::processSet().
void MSVehicle::Influencer::setConsiderMaxDeceleration | ( | bool | value | ) |
Sets whether the maximum deceleration shall be regarded.
[in] | value | Whether the maximum deceleration shall be regarded |
Definition at line 406 of file MSVehicle.cpp.
References myConsiderMaxDeceleration.
Referenced by TraCIServerAPI_Vehicle::processSet().
void MSVehicle::Influencer::setConsiderSafeVelocity | ( | bool | value | ) |
Sets whether the safe velocity shall be regarded.
[in] | value | Whether the safe velocity shall be regarded |
Definition at line 394 of file MSVehicle.cpp.
References myConsiderSafeVelocity.
Referenced by TraCIServerAPI_Vehicle::processSet().
void MSVehicle::Influencer::setEmergencyBrakeRedLight | ( | bool | value | ) |
Sets whether red lights shall be a reason to brake.
[in] | value | Whether red lights shall be a reason to brake |
Definition at line 418 of file MSVehicle.cpp.
References myEmergencyBrakeRedLight.
Referenced by TraCIServerAPI_Vehicle::processSet().
void MSVehicle::Influencer::setLaneChangeMode | ( | int | value | ) |
Sets lane changing behavior.
[in] | value | a bitset controlling the different modes |
Definition at line 424 of file MSVehicle.cpp.
References myCooperativeLC, myRightDriveLC, mySpeedGainLC, myStrategicLC, mySublaneLC, and myTraciLaneChangePriority.
Referenced by TraCIServerAPI_Vehicle::processSet().
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 253 of file MSVehicle.cpp.
References myLaneTimeLine.
Referenced by TraCIServerAPI_Vehicle::processSet().
void MSVehicle::Influencer::setRespectJunctionPriority | ( | bool | value | ) |
Sets whether junction priority rules shall be respected.
[in] | value | Whether junction priority rules be respected |
Definition at line 412 of file MSVehicle.cpp.
References myRespectJunctionPriority.
Referenced by TraCIServerAPI_Vehicle::processSet().
void MSVehicle::Influencer::setSpeedTimeLine | ( | const std::vector< std::pair< SUMOTime, SUMOReal > > & | speedTimeLine | ) |
Sets a new velocity timeline.
[in] | speedTimeLine | The time line of speeds to use |
Definition at line 246 of file MSVehicle.cpp.
References mySpeedAdaptationStarted, and mySpeedTimeLine.
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 435 of file MSVehicle.cpp.
References myLastVTDAccess, myVTDAngle, myVTDEdgeOffset, myVTDLane, myVTDPos, myVTDPosLat, myVTDRoute, and myVTDXYPos.
Referenced by TraCIServer::setVTDControlled().
|
private |
Whether the maximum acceleration shall be regarded.
Definition at line 1253 of file MSVehicle.h.
Referenced by getSpeedMode(), influenceSpeed(), and setConsiderMaxAcceleration().
|
private |
Whether the maximum deceleration shall be regarded.
Definition at line 1256 of file MSVehicle.h.
Referenced by getSpeedMode(), influenceSpeed(), and setConsiderMaxDeceleration().
|
private |
Whether the safe velocity shall be regarded.
Definition at line 1250 of file MSVehicle.h.
Referenced by getSpeedMode(), influenceSpeed(), and setConsiderSafeVelocity().
|
private |
lane changing with the intent to help other vehicles
Definition at line 1278 of file MSVehicle.h.
Referenced by influenceChangeDecision(), and setLaneChangeMode().
|
private |
Whether red lights are a reason to brake.
Definition at line 1262 of file MSVehicle.h.
Referenced by getSpeedMode(), and setEmergencyBrakeRedLight().
|
private |
The lane usage time line to apply.
Definition at line 1241 of file MSVehicle.h.
Referenced by changeRequestRemainingSeconds(), influenceChangeDecision(), and setLaneTimeLine().
|
private |
Definition at line 1271 of file MSVehicle.h.
Referenced by isVTDAffected(), isVTDControlled(), and setVTDControlled().
|
private |
The velocity before influence.
Definition at line 1244 of file MSVehicle.h.
Referenced by influenceSpeed().
|
private |
Whether the junction priority rules are respected.
Definition at line 1259 of file MSVehicle.h.
Referenced by getSpeedMode(), and setRespectJunctionPriority().
|
private |
changing to the rightmost lane
Definition at line 1282 of file MSVehicle.h.
Referenced by influenceChangeDecision(), and setLaneChangeMode().
|
private |
Whether influencing the speed has already started.
Definition at line 1247 of file MSVehicle.h.
Referenced by influenceSpeed(), and setSpeedTimeLine().
|
private |
lane changing to travel with higher speed
Definition at line 1280 of file MSVehicle.h.
Referenced by influenceChangeDecision(), and setLaneChangeMode().
The velocity time line to apply.
Definition at line 1238 of file MSVehicle.h.
Referenced by influenceSpeed(), and setSpeedTimeLine().
|
private |
lane changing which is necessary to follow the current route
Definition at line 1276 of file MSVehicle.h.
Referenced by influenceChangeDecision(), and setLaneChangeMode().
|
private |
changing to the prefered lateral alignment
Definition at line 1284 of file MSVehicle.h.
Referenced by influenceChangeDecision(), and setLaneChangeMode().
|
private |
flags for determining the priority of traci lane change requests
Definition at line 1287 of file MSVehicle.h.
Referenced by influenceChangeDecision(), and setLaneChangeMode().
|
private |
Definition at line 1268 of file MSVehicle.h.
Referenced by postProcessVTD(), and setVTDControlled().
|
private |
Definition at line 1269 of file MSVehicle.h.
Referenced by postProcessVTD(), and setVTDControlled().
|
private |
Definition at line 1265 of file MSVehicle.h.
Referenced by implicitDeltaPosVTD(), implicitSpeedVTD(), postProcessVTD(), and setVTDControlled().
|
private |
Definition at line 1266 of file MSVehicle.h.
Referenced by implicitDeltaPosVTD(), implicitSpeedVTD(), postProcessVTD(), and setVTDControlled().
|
private |
Definition at line 1267 of file MSVehicle.h.
Referenced by postProcessVTD(), and setVTDControlled().
|
private |
Definition at line 1270 of file MSVehicle.h.
Referenced by postProcessVTD(), and setVTDControlled().
|
private |
Definition at line 1264 of file MSVehicle.h.
Referenced by implicitDeltaPosVTD(), implicitSpeedVTD(), postProcessVTD(), and setVTDControlled().