Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
We have upgraded GitLab to 15.1. Due to major code changes GitLab was down for some time.
Open sidebar
vadere
vadere
Commits
dceda168
Commit
dceda168
authored
May 13, 2020
by
Benedikt Kleinmeier
Browse files
Fixed TODOs in "ThreatCognitionModel.java"
parent
dafed52d
Pipeline
#253619
passed with stages
in 131 minutes and 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Scenarios/ModelTests/TestPsychology/CognitionAndBehavior/scenarios/17-Threat-ImitatingBehavior-SelfCatThreatModel.scenario
View file @
dceda168
...
...
@@ -64,7 +64,7 @@
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
"submodels" : [ ]
},
"probabilityInGroupMembership" :
0
.0
"probabilityInGroupMembership" :
1
.0
},
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
...
...
VadereSimulator/src/org/vadere/simulator/control/psychology/cognition/ThreatCognitionModel.java
View file @
dceda168
...
...
@@ -34,7 +34,6 @@ public class ThreatCognitionModel implements ICognitionModel {
}
@Override
// TODO: Maybe, use also use cooperative behavior from "CooperativeCognitionModel".
public
void
update
(
Collection
<
Pedestrian
>
pedestrians
)
{
for
(
Pedestrian
pedestrian
:
pedestrians
)
{
if
(
pedestrian
.
getMostImportantStimulus
()
instanceof
Threat
)
{
...
...
@@ -103,18 +102,26 @@ public class ThreatCognitionModel implements ICognitionModel {
}
}
/* If a threatened pedestrian is nearby, use the same reaction as if
* the current "pedestrian" would have perceived the same threat.
* I.e., store the perceived threat and use "INSIDE_THREAT_AREA" to
* accelerate and search for a safe zone.
/**
* If a threatened ingroup pedestrian is nearby, use the same reaction as if
* the current "pedestrian" would have perceived the same threat. I.e, imitate
* the behavior of the perceived and threatened ingroup member:
*
* <ol>
* <li>Firstly, accelerate and get out of threat area.</li>
* <li>Then, search for a safe zone.</li>
* </ol>
*
* This behavior is triggered by method {@link #handleThreat(Pedestrian, Stimulus)}.
*/
private
void
imitateThreatenedPedestrianIfPresent
(
Pedestrian
pedestrian
)
{
// TODO: Use only pedestrians with GroupMembership.IN_GROUP!
// TODO: Maybe, alse look for "SelfCategory.INSIDE_THREAT_AREA".
List
<
Pedestrian
>
threatenedPedestrians
=
getClosestPedestriansWithSelfCategory
(
pedestrian
,
SelfCategory
.
OUTSIDE_THREAT_AREA
);
List
<
Pedestrian
>
threatenedIngroupPeds
=
threatenedPedestrians
.
stream
()
.
filter
(
ped
->
ped
.
getGroupMembership
()
==
GroupMembership
.
IN_GROUP
)
.
collect
(
Collectors
.
toList
());
if
(
threatened
Pedestrian
s
.
isEmpty
()
==
false
)
{
Pedestrian
threatenedPedestrian
=
threatened
Pedestrian
s
.
get
(
0
);
if
(
threatened
IngroupPed
s
.
isEmpty
()
==
false
)
{
Pedestrian
threatenedPedestrian
=
threatened
IngroupPed
s
.
get
(
0
);
Threat
latestThreat
=
threatenedPedestrian
.
getThreatMemory
().
getLatestThreat
();
assert
latestThreat
!=
null
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment