 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
43 myWidth(lane->getWidth()),
45 myFreeSublanes((int)myVehicles.size()),
48 myHasVehicles(false) {
76 int rightmost, leftmost;
79 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
115 double rightVehSide =
MAX2(0., vehCenter - vehHalfWidth);
116 double leftVehSide =
MIN2(
myWidth, vehCenter + vehHalfWidth);
121 rightVehSide -= maneuverDist;
125 leftVehSide += maneuverDist;
146 assert(sublane >= 0);
149 rightSide = sublane * res + latOffset;
150 leftSide =
MIN2((sublane + 1) * res,
myWidth) + latOffset;
156 assert(sublane >= 0);
164 std::ostringstream oss;
165 oss.setf(std::ios::fixed, std::ios::floatfield);
166 oss << std::setprecision(2);
167 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
183 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
198 myDistances(myVehicles.size(), std::numeric_limits<double>::max()) {
204 myDistances(1, cLeaderDist.second) {
218 if (veh ==
nullptr) {
225 if (sublane >= 0 && sublane < (
int)
myVehicles.size()) {
237 int rightmost, leftmost;
239 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
263 assert(sublane >= 0);
271 std::ostringstream oss;
272 oss.setf(std::ios::fixed, std::ios::floatfield);
273 oss << std::setprecision(2);
274 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
297 myMissingGaps(myVehicles.size(), -std::numeric_limits<double>::max()) {
306 if (veh ==
nullptr) {
310 const double missingGap = requiredGap - gap;
335 if (sublane >= 0 && sublane < (
int)
myVehicles.size()) {
355 int rightmost, leftmost;
357 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
389 std::ostringstream oss;
390 oss.setf(std::ios::fixed, std::ios::floatfield);
391 oss << std::setprecision(2);
392 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
void getSublaneBorders(int sublane, double latOffset, double &rightSide, double &leftSide) const
bool hasStoppedVehicle() const
whether a stopped vehicle is leader
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
CLeaderDist operator[](int sublane) const
return the vehicle and its distance for the given sublane
virtual ~MSCriticalFollowerDistanceInfo()
Destructor.
void clear()
discard all information
Representation of a lane in the micro simulation.
saves leader/follower vehicles and their distances relative to an ego vehicle
MSLeaderInfo(const MSLane *lane, const MSVehicle *ego=0, double latOffset=0)
Constructor.
virtual double getSecureGap(const MSVehicle *const, const MSVehicle *const, const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
int myFreeSublanes
the number of free sublanes
double getMaxSpeedLat() const
Get vehicle's maximum lateral speed [m/s].
SUMOTime getActionStepLength() const
Returns the vehicle's action step length in millisecs, i.e. the interval between two action points.
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
virtual ~MSLeaderInfo()
Destructor.
double myWidth
the width of the lane to which this instance applies
virtual int addLeader(const MSVehicle *veh, bool beyond, double latOffset=0)
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
MSAbstractLaneChangeModel & getLaneChangeModel()
static double gLateralResolution
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
int egoRightMost
borders of the ego vehicle for filtering of free sublanes
void getSubLanes(const MSVehicle *veh, double latOffset, int &rightmost, int &leftmost) const
std::vector< const MSVehicle * > myVehicles
virtual void clear()
discard all information
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
MSCriticalFollowerDistanceInfo(const MSLane *lane, const MSVehicle *ego, double latOffset)
Constructor.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
virtual std::string toString() const
print a debugging representation
virtual ~MSLeaderDistanceInfo()
Destructor.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
double getManeuverDist() const
Returns the remaining unblocked distance for the current maneuver. (only used by sublane model)
const MSVehicle * operator[](int sublane) const
return the vehicle for the given sublane
std::string toString() const
print a debugging representation
int addFollower(const MSVehicle *veh, const MSVehicle *ego, double gap, double latOffset=0, int sublane=-1)
virtual int addLeader(const MSVehicle *veh, double gap, double latOffset=0, int sublane=-1)
virtual std::string toString() const
print a debugging representation
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
double getSpeed() const
Returns the vehicle's current speed.
std::vector< double > myMissingGaps
std::vector< double > myDistances
std::pair< const MSVehicle *, double > CLeaderDist
virtual void clear()
discard all information
MSLeaderDistanceInfo(const MSLane *lane, const MSVehicle *ego, double latOffset)
Constructor.
Representation of a vehicle in the micro simulation.