50 myWidth(lane->getWidth()),
52 myFreeSublanes((int)myVehicles.size()),
55 myHasVehicles(false) {
83 int rightmost, leftmost;
86 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
122 const double rightVehSide =
MAX2(0., vehCenter - vehHalfWidth);
123 const double leftVehSide =
MIN2(
myWidth, vehCenter + vehHalfWidth);
141 assert(sublane >= 0);
150 assert(sublane >= 0);
158 std::ostringstream oss;
159 oss.setf(std::ios::fixed , std::ios::floatfield);
160 oss << std::setprecision(2);
161 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
177 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
192 myDistances(
myVehicles.size(), std::numeric_limits<double>::
max()) {
218 if (sublane >= 0 && sublane < (
int)
myVehicles.size()) {
230 int rightmost, leftmost;
232 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
256 assert(sublane >= 0);
264 std::ostringstream oss;
265 oss.setf(std::ios::fixed , std::ios::floatfield);
266 oss << std::setprecision(2);
267 for (
int i = 0; i < (int)
myVehicles.size(); ++i) {
290 myMissingGaps(
myVehicles.size(), -std::numeric_limits<double>::
max()) {
303 const double missingGap = requiredGap - gap;
328 if (sublane >= 0 && sublane < (
int)
myVehicles.size()) {
343 int rightmost, leftmost;
345 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
372 std::ostringstream oss;
373 oss.setf(std::ios::fixed , std::ios::floatfield);
374 oss << std::setprecision(2);
375 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
void getSublaneBorders(int sublane, double latOffset, double &rightSide, double &leftSide) const
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
virtual ~MSCriticalFollowerDistanceInfo()
Destructor.
virtual std::string toString() const
print a debugging representation
int myFreeSublanes
the number of free sublanes
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)
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
bool hasStoppedVehicle() const
whether a stopped vehicle is leader
std::vector< double > myDistances
CLeaderDist operator[](int sublane) const
return the vehicle and its distance for the given sublane
virtual int addLeader(const MSVehicle *veh, double gap, double latOffset=0, int sublane=-1)
std::vector< double > myMissingGaps
virtual ~MSLeaderInfo()
Destructor.
virtual void clear()
discard all information
const MSVehicle * operator[](int sublane) const
return the vehicle for the given sublane
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
void getSubLanes(const MSVehicle *veh, double latOffset, int &rightmost, int &leftmost) const
void clear()
discard all information
virtual ~MSLeaderDistanceInfo()
Destructor.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
std::vector< const MSVehicle * > myVehicles
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.
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
std::string toString() const
print a debugging representation
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 getSpeed() const
Returns the vehicle's current speed.