Hack to keep agents without goal in the simu

parent 60f675c5
......@@ -212,7 +212,7 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
for (int i = 0; i < size; i++) {
Pedestrian* ped1 = neighbours[i];
// if (ped->GetID() == 71) {
// std::cout << "Velocity Model debug ped1: " << ped1->GetID() << "\t" << ped1->GetPos().toString() <<std::endl;
......@@ -352,9 +352,19 @@ Point VelocityModel::e0(Pedestrian* ped, Room* room) const
Point target;
if(_direction && ped->GetExitLine())
target = _direction->GetTarget(room, ped); // target is where the ped wants to be after the next timestep
else {
else { //@todo: we need a model for waiting pedestrians
std::cout << ped->GetID() << " VelocityModel::e0 Ped has no navline.\n";
exit(EXIT_FAILURE);
//exit(EXIT_FAILURE);
// set random destination
std::mt19937 mt(ped->GetBuilding()->GetConfig()->GetSeed());
std::uniform_real_distribution<double> dist(0, 1.0);
double random_x = dist(mt);
double random_y = dist(mt);
Point P1 = Point(ped->GetPos()._x - random_x, ped->GetPos()._y - random_y);
Point P2 = Point(ped->GetPos()._x + random_x, ped->GetPos()._y + random_y);
const NavLine L = Line(P1, P2);
ped->SetExitLine((const NavLine *)&L);
target = P1;
}
Point desired_direction;
const Point pos = ped->GetPos();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment