10.12., 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 1975891b authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

Added print statements in "OSMBehaviorController" to debug why salient...

Added print statements in "OSMBehaviorController" to debug why salient behavior causes an "AssertionError" when using event-driven update scheme.
parent ec1bfe94
{
"name" : "01-ExperimentSetup-OSMEventDriven",
"description" : "",
"release" : "0.8",
"release" : "0.9",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......@@ -671,7 +671,7 @@
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 10,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0
......
{
"name" : "02-ExperimentSetup-OSMSequential",
"description" : "",
"release" : "0.8",
"release" : "0.9",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
{
"name" : "03-UnidirectionalFlow-OSMSequential",
"description" : "",
"release" : "0.8",
"release" : "0.9",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
{
"name" : "04-CounterFlow-OSMSequential",
"description" : "",
"release" : "0.8",
"release" : "0.9",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
......
......@@ -11,6 +11,7 @@ import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.state.simulation.VTrajectory;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.Vector2D;
......@@ -247,6 +248,7 @@ public class OSMBehaviorController {
VPoint newPosition = pedestrian2.getPosition().clone();
VPoint oldPosition = pedestrian1.getPosition().clone();
// TODO Set also "timeOfNextStep" and "stepDuration" proberly.
pedestrian1.setNextPosition(newPosition);
pedestrian2.setNextPosition(oldPosition);
......@@ -254,6 +256,36 @@ public class OSMBehaviorController {
// Number of pedestrians in LinkedCellGrid does not match number of pedestrians in topography".
makeStep(pedestrian1, topography, pedestrian1.getDurationNextStep());
makeStep(pedestrian2, topography, pedestrian2.getDurationNextStep());
printDebugInfos(pedestrian1, pedestrian2);
}
private void printDebugInfos(PedestrianOSM pedestrian1, PedestrianOSM pedestrian2) {
PedestrianOSM[] pedestrians = new PedestrianOSM[] { pedestrian1, pedestrian2 };
for (int i = 0; i < pedestrians.length; i++) {
PedestrianOSM currentPed = pedestrians[i];
System.out.println(String.format("Position %d: %s", currentPed.getId(), currentPed.getPosition()));
System.out.println(String.format("Trajectory %d: %s", currentPed.getId(), currentPed.getFootSteps()));
LinkedList<FootStep> currentFootsteps = currentPed.getFootSteps().getFootSteps();
if (currentFootsteps.size() >= 2) {
for (i = 1; i < currentFootsteps.size(); i++) {
FootStep previousFootstep = currentFootsteps.get(i - 1);
FootStep currentFootstep = currentFootsteps.get(i);
if (previousFootstep.getEndTime() > currentFootstep.getStartTime()) {
System.out.println(String.format(" Assertion failed (at index %d): previousEndTime > currentStartTime", i));
System.out.println(String.format(" %.2f -> %.2f (positions: %s -> %s)",
previousFootstep.getEndTime(), currentFootstep.getStartTime(),
previousFootstep.getEnd(), currentFootstep.getStart()
));
}
}
}
}
}
}
......@@ -104,6 +104,7 @@ public class Pedestrian extends Agent {
public ScenarioElementType getType() {
return ScenarioElementType.PEDESTRIAN;
}
// TODO Rename "getFootSteps()" to "getTrajectory()".
public VTrajectory getFootSteps() {
return trajectory;
}
......
......@@ -38,6 +38,10 @@ public class VTrajectory implements Iterable<FootStep> {
}
// Methods
public int size() {
return footSteps.size();
}
public Optional<Double> speed(@NotNull final VRectangle rectangle) {
VTrajectory cutting = clone();
cutting.cut(rectangle);
......
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