44 myWidth(lane->getWidth()),
46 myFreeSublanes((int)myVehicles.size()),
49 myHasVehicles(false) {
77 int rightmost, leftmost;
80 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
116 double rightVehSide =
MAX2(0., vehCenter - vehHalfWidth);
117 double leftVehSide =
MIN2(
myWidth, vehCenter + vehHalfWidth);
122 rightVehSide -= maneuverDist;
126 leftVehSide += maneuverDist;
147 assert(sublane >= 0);
150 rightSide = sublane * res + latOffset;
151 leftSide =
MIN2((sublane + 1) * res,
myWidth) + latOffset;
157 assert(sublane >= 0);
165 std::ostringstream oss;
166 oss.setf(std::ios::fixed, std::ios::floatfield);
167 oss << std::setprecision(2);
168 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
184 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
199 myDistances(
myVehicles.size(), std::numeric_limits<double>::max()) {
219 if (veh ==
nullptr) {
226 if (sublane >= 0 && sublane < (
int)
myVehicles.size()) {
238 int rightmost, leftmost;
240 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
264 assert(sublane >= 0);
272 std::ostringstream oss;
273 oss.setf(std::ios::fixed, std::ios::floatfield);
274 oss << std::setprecision(2);
275 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
298 myMissingGaps(
myVehicles.size(), -std::numeric_limits<double>::max()) {
307 if (veh ==
nullptr) {
311 const double missingGap = requiredGap - gap;
336 if (sublane >= 0 && sublane < (
int)
myVehicles.size()) {
356 int rightmost, leftmost;
358 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
390 std::ostringstream oss;
391 oss.setf(std::ios::fixed, std::ios::floatfield);
392 oss << std::setprecision(2);
393 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
static double gLateralResolution
saves leader/follower vehicles and their distances relative to an ego vehicle
MSLeaderDistanceInfo(const MSLane *lane, const MSVehicle *ego, double latOffset)
Constructor.
Representation of a vehicle in the micro simulation.
virtual int addLeader(const MSVehicle *veh, bool beyond, double latOffset=0)
virtual std::string toString() const
print a debugging representation
virtual ~MSCriticalFollowerDistanceInfo()
Destructor.
int myFreeSublanes
the number of free sublanes
double getManeuverDist() const
Returns the remaining unblocked distance for the current maneuver. (only used by sublane model) ...
virtual void clear()
discard all information
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
int egoRightMost
borders of the ego vehicle for filtering of free sublanes
double myWidth
the width of the lane to which this instance applies
MSAbstractLaneChangeModel & getLaneChangeModel()
std::vector< double > myDistances
virtual int addLeader(const MSVehicle *veh, double gap, double latOffset=0, int sublane=-1)
std::vector< double > myMissingGaps
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
virtual ~MSLeaderInfo()
Destructor.
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...
virtual double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
SUMOTime getActionStepLength() const
Returns the vehicle's action step length in millisecs, i.e. the interval between two action points...
const MSVehicle * operator[](int sublane) const
return the vehicle for the given sublane
void getSubLanes(const MSVehicle *veh, double latOffset, int &rightmost, int &leftmost) const
std::string toString() const
print a debugging representation
void clear()
discard all information
virtual ~MSLeaderDistanceInfo()
Destructor.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
std::vector< const MSVehicle * > myVehicles
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
bool hasStoppedVehicle() const
whether a stopped vehicle is leader
double getMaxSpeedLat() const
Get vehicle's maximum lateral speed [m/s].
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
std::pair< const MSVehicle *, double > CLeaderDist
int addFollower(const MSVehicle *veh, const MSVehicle *ego, double gap, double latOffset=0, int sublane=-1)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
void getSublaneBorders(int sublane, double latOffset, double &rightSide, double &leftSide) const
CLeaderDist operator[](int sublane) const
return the vehicle and its distance for the given sublane
double getSpeed() const
Returns the vehicle's current speed.
MSLeaderInfo(const MSLane *lane, const MSVehicle *ego=0, double latOffset=0)
Constructor.
Representation of a lane in the micro simulation.
MSCriticalFollowerDistanceInfo(const MSLane *lane, const MSVehicle *ego, double latOffset)
Constructor.
double getSpeedLat() const
return the lateral speed of the current lane change maneuver