Skip to content

Commit

Permalink
fixing typo and some refactoring #22 #12
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Jun 30, 2024
1 parent 53cad62 commit ef10af7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/microsim/transportables/MSPModel_Striping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define DEBUGID1 ""
#define DEBUGID2 ""
//#define DEBUGCOND(PED) (false)
//#define DEBUGCOND(PED) ((PED).myPerson->getID() == DEBUGID1 || (PED).myPerson->getID() == DEBUGID2)
//#define DEBUGCOND(PED) ((PED).getPerson()->getID() == DEBUGID1 || (PED).getPerson()->getID() == DEBUGID2)
#define DEBUGCOND(PED) ((PED).getPerson()->isSelected())
#define DEBUGCOND2(LANE) ((LANE)->isSelected())
//#define LOG_ALL 1
Expand Down Expand Up @@ -802,8 +802,7 @@ MSPModel_Striping::getNextLaneObstacles(NextLanesObstacles& nextLanesObs, const

void
MSPModel_Striping::transformToCurrentLanePositions(Obstacles& obs, int currentDir, int nextDir, double currentLength, double nextLength) {
for (int ii = 0; ii < (int)obs.size(); ++ii) {
Obstacle& o = obs[ii];
for (Obstacle& o : obs) {
if (currentDir == FORWARD) {
if (nextDir == FORWARD) {
o.xFwd += currentLength;
Expand Down Expand Up @@ -1060,7 +1059,7 @@ MSPModel_Striping::moveInDirectionOnLane(Pedestrians& pedestrians, const MSLane*
if (p.getDirection() != dir || changedLane.count(p.getPerson()) != 0 || p.getRemotePosition() != Position::INVALID) {
if (!p.isWaitingToEnter() && !p.isJammed()) {
//if DEBUGCOND(p) {
// std::cout << " obs=" << p.getPerson()->getID() << " y=" << p.myPosLat << " stripe=" << p.stripe() << " oStripe=" << p.otherStripe() << "\n";
// std::cout << " obs=" << p.getPerson()->getID() << " y=" << p.getPosLat() << " stripe=" << p.stripe() << " oStripe=" << p.otherStripe() << "\n";
//}
Obstacle o(p);
if (p.getDirection() != dir && p.getSpeed(*p.getStage()) == 0.) {
Expand Down Expand Up @@ -2232,11 +2231,11 @@ void
MSPModel_Striping::PState::reverse(const double pathLength, const double usableWidth) {
myEdgePos = pathLength - myEdgePos;
myPosLat = usableWidth - myPosLat;
myDir = !myWalkingAreaPath->dir;
mySpeed = -mySpeed;
myDir = -myWalkingAreaPath->dir;
mySpeedLat = -mySpeedLat;
}


void
MSPModel_Striping::PState::reset(const double edgePos, const double latPos) {
myEdgePos = edgePos;
Expand Down
4 changes: 2 additions & 2 deletions src/microsim/transportables/MSPModel_Striping.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class MSPModel_Striping : public MSPModel_Interacting {
Obstacle(int dir, double dist = DIST_FAR_AWAY);
/// @brief create an obstacle from ped for ego moving in dir
Obstacle(const PState& ped);
/// @brief create an obstacle from explict values
/// @brief create an obstacle from explicit values
Obstacle(double _x, double _speed, ObstacleType _type, const std::string& _description, const double width = 0., const SUMOVehicle* veh = nullptr)
: xFwd(_x + width / 2.), xBack(_x - width / 2.), speed(_speed), type(_type), description(_description), vehicle(veh) {};

Expand All @@ -211,7 +211,7 @@ class MSPModel_Striping : public MSPModel_Interacting {
double xBack;
/// @brief speed relative to lane direction (positive means in the same direction)
double speed;
/// @brief whether this obstacle denotes a border or a pedestrian
/// @brief whether this obstacle denotes a border, a vehicle or a pedestrian
ObstacleType type;
/// @brief the id / description of the obstacle
std::string description;
Expand Down

0 comments on commit ef10af7

Please sign in to comment.