-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of GAS stress model as a plugin (#23)
* Add initial gas stress plug-in This represents the initial gas action -- it applies stress to agents. 1) Kind of clunky 2) Can't be configured. * Add stress demo This is a variation of the periodic demo but with stress added. * Add stress plugin to linux build Add the appropriate cmake infrastructure. * Correct linux compatibility Account for file case and use proper linux-compatible directory slashes. * Cosmetics clean up Scrubbed code documentation. Made sure it was of appropriate format and confirmed that the comments actually referred to this code (as opposed to the source it was copied from.) * New stress action architecture Whole new system for accumulating stress. 1) BaseStressAction is responsible for registering agents with the manager, handling exit behavior, defining the stress vector. a) Sub-class it to apply different stress functions to agents. 2) Stress functions define how stress is defined. This includes a single kind of stress function: timed stress function. Stress simply accumulates at a linear rate up to 100% stress. Removed old action, re-wired manager, modified sample scenarios. WIP: In release mode, it arbitrarily crashes. I need to figure out why that is. * Modify stress enumeration access to match C++ access I had used C# style accessors (e.g., EnumName::EnuMValue). Visual studio is content with this, but G++ gets cranky. * Correct include path to be linux compatible I had backslashes that needed to be forward. * Improve attribute set parsing warning messages If a distribution is expected to be read and it is not found, the warning message now includes the prefix. * Added missing lock to manager Because the manager gets executed in parallel (agents can enter and exit) it is important that the underlying hash map be protected. Introduced a readers/writer lock to allow multiple readers and single writer (eventually). * Correct cool down function The cool down function now properly performs cool down based on time step. The cool down period can also be specified in XML. * Added sample of the cooldown functionality It shows three agents: 1) One agent continues accumulating stress 2) One cools down in 5 seconds 3) One cools down in 10 seconds. * Rename StressTasks to StressTask (Changed plural to singular because there is only a single task.) * Add dll export to more of the classes * Update doxygen material The stress functionality is now documented and the validity has been confirmed. * Stress ending demo This demo shows the exit_behavior of the stress action, showing different behaviors (continue vs cool down) and different cool down rates. * Correct doxygen type * Update gitignore for my local build * Initial implementation of distance stress function Largely just a place holder; actual functionality still missing. * Updated release notes * Manager removes stress functions when cool down is completed The stress function signals that it is done and will not be evaluated again. * Cleaned up zombie line of code. * Add distance stress function An action will initiate stress based on proximity to a region. This includes the DistanceStressAction, DistanceStressFunction, and a demo. * Doxygen correction * Updated release notes * Update run all demos scripts Add the stress demos to the various scripts.
- Loading branch information
1 parent
d714882
commit 6ac6dae
Showing
48 changed files
with
2,771 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
debug/ | ||
Exe/ | ||
release/ | ||
doc/ | ||
bug_examples/ | ||
COPY.txt | ||
*.scb | ||
*.suo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0"?> | ||
|
||
<Project | ||
scene="stress/stressS.xml" | ||
behavior="stress/stressB.xml" | ||
view="stress/stressV.xml" | ||
model="orca" | ||
dumpPath="stress/images" | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0"?> | ||
|
||
<BFSM> | ||
<GoalSet id="0"> | ||
<Goal type="point" id="0" x="-15" y="0.0"/> | ||
<Goal type="point" id="1" x="15" y="0.0"/> | ||
</GoalSet> | ||
|
||
<State name="Walk1_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
</State> | ||
|
||
<State name="Walk1" final="0" > | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="continue" | ||
duration_dist="c" duration_value="30" | ||
radius_dist="c" radius_value="0.1" | ||
/> | ||
</State> | ||
<State name="GoalReached1" final="0"> | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="zero" /> | ||
<Action type="teleport" dist="u" min_x="13.5" max_x="14" min_y="-1.5" max_y="1.5" /> | ||
</State> | ||
|
||
<Transition from="Walk1_0" to="Walk1" > | ||
<Condition type="timer" per_agent="0" dist="c" value="1" /> | ||
</Transition> | ||
<Transition from="Walk1_0" to="GoalReached1" > | ||
<Condition type="AABB" min_x="-40" max_x="-13.5" min_y="-2.0" max_y="2.0" inside="1" /> | ||
</Transition> | ||
<Transition from="Walk1" to="GoalReached1" > | ||
<Condition type="AABB" min_x="-40" max_x="-13.5" min_y="-2.0" max_y="2.0" inside="1" /> | ||
</Transition> | ||
<Transition from="GoalReached1" to="Walk1" > | ||
<Condition type="auto" /> | ||
</Transition> | ||
|
||
|
||
<State name="Walk2_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="1" /> | ||
<VelComponent type="goal" /> | ||
</State> | ||
<State name="Walk2" final="0" > | ||
<GoalSelector type="explicit" goal_set="0" goal="1" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="continue" | ||
duration_dist="c" duration_value="30" | ||
radius_dist="c" radius_value="0.1" | ||
/> | ||
</State> | ||
<State name="GoalReached2" final="0"> | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="zero" /> | ||
<Action type="teleport" dist="u" min_x="-14.0" max_x="-13.5" min_y="-1.5" max_y="1.5" /> | ||
</State> | ||
|
||
<Transition from="Walk2_0" to="Walk2" > | ||
<Condition type="timer" per_agent="0" dist="c" value="10" /> | ||
</Transition> | ||
<Transition from="Walk2_0" to="GoalReached2" > | ||
<Condition type="AABB" min_x="13.5" max_x="40.0" min_y="-2.0" max_y="2.0" inside="1" /> | ||
</Transition> | ||
<Transition from="Walk2" to="GoalReached2" > | ||
<Condition type="AABB" min_x="13.5" max_x="40.0" min_y="-2.0" max_y="2.0" inside="1" /> | ||
</Transition> | ||
<Transition from="GoalReached2" to="Walk2" > | ||
<Condition type="auto" /> | ||
</Transition> | ||
|
||
</BFSM> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0"?> | ||
|
||
<BFSM> | ||
<GoalSet id="0"> | ||
<Goal type="point" id="0" x="30" y="0.0"/> | ||
</GoalSet> | ||
|
||
<State name="Walk1_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="cool down" | ||
duration_dist="c" duration_value="10" | ||
/> | ||
</State> | ||
|
||
<State name="Walk2_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="continue" | ||
duration_dist="c" duration_value="10" | ||
/> | ||
</State> | ||
|
||
<State name="Walk3_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="cool down" | ||
cool_duration_dist="c" cool_duration_value="15" | ||
duration_dist="c" duration_value="10" | ||
/> | ||
</State> | ||
|
||
<State name="EndStressor" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
</State> | ||
|
||
<State name="GoalReached" final="1"> | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="zero" /> | ||
</State> | ||
|
||
<Transition from="Walk1_0" to="EndStressor" > | ||
<Condition type="AABB" min_x="15" max_x="16" min_y="-3" max_y="3.0" inside="1" /> | ||
</Transition> | ||
<Transition from="Walk2_0" to="EndStressor" > | ||
<Condition type="AABB" min_x="15" max_x="16" min_y="-3" max_y="3.0" inside="1" /> | ||
</Transition> | ||
<Transition from="Walk3_0" to="EndStressor" > | ||
<Condition type="AABB" min_x="15" max_x="16" min_y="-3" max_y="3.0" inside="1" /> | ||
</Transition> | ||
<Transition from="EndStressor" to="GoalReached" > | ||
<Condition type="goal_reached" distance="0.2" /> | ||
</Transition> | ||
|
||
|
||
</BFSM> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0"?> | ||
|
||
<Experiment version="2.0"> | ||
<SpatialQuery type="kd-tree" test_visibility="false" /> | ||
|
||
<OpenSteer max_force="8" leak_through="0.1" reaction_time="0.5" /> | ||
<Common time_step="0.1" /> | ||
<Helbing agent_scale="2000" obstacle_scale="4000" reaction_time="0.5" body_force="1200" friction="2400" force_distance="0.015" /> | ||
<Johansson agent_scale="25" obstacle_scale="35" reaction_time="0.5" force_distance="0.15" stride_time="0.5" /> | ||
<Karamouzas orient_weight="0.8" fov="200" reaction_time="0.4" wall_steepness="2" wall_distance="2" colliding_count="5" d_min="1" d_mid="8" d_max="10" agent_force="4" /> | ||
<Zanlungo agent_scale="2000" obstacle_scale="4000" reaction_time="0.5" force_distance="0.005" /> | ||
<Dummy stddev="0.05" /> | ||
|
||
<AgentProfile name="group1" > | ||
<Common max_angle_vel="360" max_neighbors="10" obstacleSet="1" neighbor_dist="5" r="0.19" class="1" pref_speed="1.04" max_speed="2" max_accel="5" priority="0.0"/> | ||
<Helbing mass="80" /> | ||
<Johansson fov_weight="0.16" /> | ||
<Karamouzas personal_space="0.69" anticipation="8" /> | ||
<ORCA tau="3.0" tauObst="0.15" /> | ||
<PedVO factor="1.57" buffer="0.9" tau="3" tauObst="0.1" turningBias="1.0" /> | ||
<Zanlungo mass="80" /> | ||
</AgentProfile> | ||
|
||
<AgentProfile name="group2" inherits="group1" > | ||
<Common class="2" /> | ||
</AgentProfile> | ||
|
||
<AgentProfile name="group3" inherits="group1" > | ||
<Common class="3" /> | ||
</AgentProfile> | ||
|
||
<AgentGroup> | ||
<ProfileSelector type="const" name="group1" /> | ||
<StateSelector type="const" name="Walk1_0" /> | ||
<Generator type="explicit"> | ||
<Agent p_x="0" p_y="1.0"/> | ||
</Generator> | ||
</AgentGroup> | ||
|
||
<AgentGroup> | ||
<ProfileSelector type="const" name="group2" /> | ||
<StateSelector type="const" name="Walk2_0" /> | ||
<Generator type="explicit"> | ||
<Agent p_x="0" p_y="-1.0"/> | ||
</Generator> | ||
</AgentGroup> | ||
|
||
<AgentGroup> | ||
<ProfileSelector type="const" name="group3" /> | ||
<StateSelector type="const" name="Walk3_0" /> | ||
<Generator type="explicit"> | ||
<Agent p_x="0" p_y="0.0"/> | ||
</Generator> | ||
</AgentGroup> | ||
|
||
</Experiment> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
|
||
<View width="640" height="214" > | ||
<!-- Multiple cameras are mapped to a key from 1-9 in the order they are defined here --> | ||
<Camera xpos="15.2799" ypos="9.13056" zpos="-0.499118" xtgt="15.2799" ytgt="0.000557631" ztgt="-0.509118" far="400" near="0.01" fov="0.0" orthoScale="0.263479" /> | ||
|
||
<!-- Comment out lights for a constant-illuminated visualization --> | ||
<Light x="1" y="0" z="-1" type="directional" diffR="1.0" diffG="0.8" diffB="0.8" space="camera"/> | ||
<Light x="-1" y="0" z="-1" type="directional" diffR="0.8" diffG="0.8" diffB="1.0" space="camera"/> | ||
<Light x="0" y="1" z="0" type="directional" diffR="0.8" diffG="0.8" diffB="0.8" space="world"/> | ||
|
||
<Watermark file_name="mengeLogo.png" alignment="bottom_right" scale="0.5" opacity="0.25"/> | ||
<Font r="1.0" g="1.0" b="1.0" a="0.75" /> | ||
</View> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0"?> | ||
|
||
<BFSM> | ||
<GoalSet id="0"> | ||
<Goal type="point" id="0" x="10" y="-1"/> | ||
</GoalSet> | ||
|
||
<State name="ToGoal" final="0" > | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="distance_stress" exit_behavior="cool down" | ||
inner_dist="c" inner_value="1.0" | ||
outer_dist="c" outer_value="4.0" | ||
fall_off="linear" | ||
shape="circle" radius="3" x="0" y="0" | ||
/> | ||
</State> | ||
<State name="GoalReached" final="1"> | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="zero" /> | ||
</State> | ||
|
||
<Transition from="ToGoal" to="GoalReached" > | ||
<Condition type="goal_reached" /> | ||
</Transition> | ||
|
||
</BFSM> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0"?> | ||
|
||
<Experiment version="2.0"> | ||
<SpatialQuery type="kd-tree" test_visibility="false" /> | ||
|
||
<OpenSteer max_force="8" leak_through="0.1" reaction_time="0.5" /> | ||
<Common time_step="0.1" /> | ||
<GCF reaction_time="0.5" max_agent_dist="2" max_agent_force="3" agent_interp_width="0.1" nu_agent="0.35" /> | ||
<Helbing agent_scale="2000" obstacle_scale="4000" reaction_time="0.5" body_force="1200" friction="2400" force_distance="0.015" /> | ||
<Johansson agent_scale="25" obstacle_scale="35" reaction_time="0.5" force_distance="0.15" stride_time="0.5" /> | ||
<Karamouzas orient_weight="0.8" fov="200" reaction_time="0.4" wall_steepness="2" wall_distance="2" colliding_count="5" d_min="1" d_mid="8" d_max="10" agent_force="4" /> | ||
<Zanlungo agent_scale="2000" obstacle_scale="4000" reaction_time="0.5" force_distance="0.005" /> | ||
<Dummy stddev="0.05" /> | ||
|
||
<AgentProfile name="group1" > | ||
<OpenSteer tau="3" tauObst="6" /> | ||
<Common max_angle_vel="360" max_neighbors="10" obstacleSet="1" neighbor_dist="5" r="0.19" class="1" pref_speed="1.04" max_speed="2" max_accel="5" priority="0.0"> | ||
<Property name="pref_speed" dist="n" mean="1.3" stddev="0.15" /> | ||
</Common> | ||
<GCF stand_depth="0.18" move_scale="0.53" slow_width="0.25" sway_change="0.05" orient_weight="0.75" /> | ||
<Helbing mass="80" /> | ||
<Johansson fov_weight="0.16" /> | ||
<Karamouzas personal_space="0.69" anticipation="8" /> | ||
<ORCA tau="3.0" tauObst="0.15" /> | ||
<PedVO factor="1.57" buffer="0.9" tau="3" tauObst="0.1" turningBias="1.0" /> | ||
<Zanlungo mass="80" /> | ||
</AgentProfile> | ||
|
||
<AgentGroup> | ||
<ProfileSelector type="const" name="group1" /> | ||
<StateSelector type="const" name="ToGoal" /> | ||
<Generator type="explicit"> | ||
<Agent p_x="-10" p_y="-1"/> | ||
</Generator> | ||
</AgentGroup> | ||
|
||
<ObstacleSet type="explicit" class="1"> | ||
<Obstacle closed="1" > | ||
<Vertex p_x="3.000000" p_y="0.000000"/> | ||
<Vertex p_x="2.853170" p_y="0.927051"/> | ||
<Vertex p_x="2.427051" p_y="1.763356"/> | ||
<Vertex p_x="1.763356" p_y="2.427051"/> | ||
<Vertex p_x="0.927051" p_y="2.853170"/> | ||
<Vertex p_x="0.000000" p_y="3.000000"/> | ||
<Vertex p_x="-0.927051" p_y="2.853170"/> | ||
<Vertex p_x="-1.763356" p_y="2.427051"/> | ||
<Vertex p_x="-2.427051" p_y="1.763356"/> | ||
<Vertex p_x="-2.853170" p_y="0.927051"/> | ||
<Vertex p_x="-3.000000" p_y="0.000000"/> | ||
<Vertex p_x="-2.853170" p_y="-0.927051"/> | ||
<Vertex p_x="-2.427051" p_y="-1.763356"/> | ||
<Vertex p_x="-1.763356" p_y="-2.427051"/> | ||
<Vertex p_x="-0.927051" p_y="-2.853170"/> | ||
<Vertex p_x="-0.000000" p_y="-3.000000"/> | ||
<Vertex p_x="0.927051" p_y="-2.853170"/> | ||
<Vertex p_x="1.763356" p_y="-2.427051"/> | ||
<Vertex p_x="2.427051" p_y="-1.763356"/> | ||
<Vertex p_x="2.853170" p_y="-0.927051"/> | ||
</Obstacle> | ||
</ObstacleSet> | ||
</Experiment> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
|
||
<View width="640" height="214" > | ||
<!-- Multiple cameras are mapped to a key from 1-9 in the order they are defined here --> | ||
<Camera xpos="0" ypos="9.13" zpos="0.01" xtgt="0" ytgt="0" ztgt="0" far="400" near="0.01" fov="0.0" orthoScale="0.334155" /> | ||
<Camera xpos="-0.161921" ypos="6.39343" zpos="10.794" xtgt="0" ytgt="0" ztgt="0" far="400" near="0.01" fov="45" /> | ||
|
||
<!-- Comment out lights for a constant-illuminated visualization --> | ||
<Light x="1" y="0" z="-1" type="directional" diffR="1.0" diffG="0.8" diffB="0.8" space="camera"/> | ||
<Light x="-1" y="0" z="-1" type="directional" diffR="0.8" diffG="0.8" diffB="1.0" space="camera"/> | ||
<Light x="0" y="1" z="0" type="directional" diffR="0.8" diffG="0.8" diffB="0.8" space="world"/> | ||
|
||
<Watermark file_name="mengeLogo.png" alignment="bottom_right" scale="0.5" opacity="0.25"/> | ||
<Font r="1.0" g="1.0" b="1.0" a="0.75" /> | ||
</View> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0"?> | ||
|
||
<BFSM> | ||
<GoalSet id="0"> | ||
<Goal type="point" id="0" x="30" y="0.0"/> | ||
</GoalSet> | ||
|
||
<State name="Walk1_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="cool down" | ||
duration_dist="c" duration_value="10" | ||
/> | ||
</State> | ||
|
||
<State name="Walk2_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="continue" | ||
duration_dist="c" duration_value="10" | ||
/> | ||
</State> | ||
|
||
<State name="Walk3_0" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
<Action type="timed_stress" exit_behavior="cool down" | ||
cool_duration_dist="c" cool_duration_value="15" | ||
duration_dist="c" duration_value="10" | ||
/> | ||
</State> | ||
|
||
<State name="EndStressor" final="0"> | ||
<GoalSelector type="explicit" goal_set="0" goal="0" /> | ||
<VelComponent type="goal" /> | ||
</State> | ||
|
||
<State name="GoalReached" final="1"> | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="zero" /> | ||
</State> | ||
|
||
<Transition from="Walk1_0" to="EndStressor" > | ||
<Condition type="AABB" min_x="15" max_x="16" min_y="-3" max_y="3.0" inside="1" /> | ||
</Transition> | ||
<Transition from="Walk2_0" to="EndStressor" > | ||
<Condition type="AABB" min_x="15" max_x="16" min_y="-3" max_y="3.0" inside="1" /> | ||
</Transition> | ||
<Transition from="Walk3_0" to="EndStressor" > | ||
<Condition type="AABB" min_x="15" max_x="16" min_y="-3" max_y="3.0" inside="1" /> | ||
</Transition> | ||
<Transition from="EndStressor" to="GoalReached" > | ||
<Condition type="goal_reached" distance="0.2" /> | ||
</Transition> | ||
|
||
|
||
</BFSM> |
Oops, something went wrong.