Commit dd7564e3 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Added Gerta's suggestion to "ThreatCognitionModel.java" to get more plausible trajectories

Nevertheless: The code should be refactored because there are a lot of
nested if-else statements which are hard to read.
parent 3432eab5
Pipeline #261953 passed with stages
in 157 minutes and 18 seconds
......@@ -56,6 +56,12 @@ public class ThreatCognitionModel implements ICognitionModel {
// Current stimulus is a threat => store it and make clear that pedestrian is inside threat area.
pedestrian.getThreatMemory().add((Threat) stimulus);
pedestrian.setSelfCategory(SelfCategory.INSIDE_THREAT_AREA);
// Gerta suggests to apply SelfCategory.OUTSIDE_THREAT_AREA
// so that agents directly search a safe zone if they are blocked by a wall.
if (pedestrianIsBlockedByObstacle(pedestrian, topography)) {
pedestrian.setSelfCategory(SelfCategory.OUTSIDE_THREAT_AREA);
}
}
private boolean isNewThreatForPedestrian(Pedestrian pedestrian, Threat threat) {
......@@ -96,7 +102,8 @@ public class ThreatCognitionModel implements ICognitionModel {
boolean pedestrianIsInsideThreatArea = (distanceToThreat <= latestThreat.getRadius());
boolean pedestrianIsBlockedByObstacle = pedestrianIsBlockedByObstacle(pedestrian, topography);
// Gerta suggests to apply SelfCategory.OUTSIDE_THREAT_AREA to agents if they are blocked by a wall.
// Gerta suggests to apply SelfCategory.OUTSIDE_THREAT_AREA
// so that agents directly search a safe zone if they are blocked by a wall.
if (pedestrianIsInsideThreatArea && pedestrianIsBlockedByObstacle == false) {
pedestrian.setSelfCategory(SelfCategory.INSIDE_THREAT_AREA);
} else {
......
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