-
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.
Introduce external event triggers to Menge and its C-API (#57)
Augmented the event system. •Added ExternalEventTrigger; a trigger object that can be exposed to external code to trigger events. •Added EventEffectAgentState; an event effect that will change the state of target agents. •Added TargetAgentById; an event target for a single agent identified by its unique id. •Augmented the viewer to detect external triggers and connect keyboard and mouse events to them. For details see src/Menge/MengeVis/Runtime/EventInjectContext.h •Added new example exercising this functionality: examples/core/userEvent.xml. A single agent placed in a diamond-shaped environement. The arrow keys control what direction the agent moves (one of the four cardinal directions). •Exposed external triggers in the C-API.
- Loading branch information
1 parent
ce58682
commit ba32a9c
Showing
43 changed files
with
1,651 additions
and
128 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
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="userEvent/userEventS.xml" | ||
behavior="userEvent/userEventB.xml" | ||
view="userEvent/userEventV.xml" | ||
model="orca" | ||
dumpPath="userEvent/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,57 @@ | ||
<?xml version="1.0"?> | ||
|
||
<BFSM> | ||
<EventSystem conservative="1"> | ||
<Target name="agent_0" type="agent_id" id="0" /> | ||
<Effect name="move_left" type="set_agent_state"> | ||
<StateSelector type="const" name="WalkLeft" /> | ||
</Effect> | ||
<Effect name="move_right" type="set_agent_state"> | ||
<StateSelector type="const" name="WalkRight" /> | ||
</Effect> | ||
<Effect name="move_up" type="set_agent_state"> | ||
<StateSelector type="const" name="WalkUp" /> | ||
</Effect> | ||
<Effect name="move_down" type="set_agent_state"> | ||
<StateSelector type="const" name="WalkDown" /> | ||
</Effect> | ||
<Event name="head_left"> | ||
<Trigger name="left_arrow" type="external" /> | ||
<Response effect="move_left" target="agent_0" /> | ||
</Event> | ||
<Event name="head_right"> | ||
<Trigger name="right_arrow" type="external" /> | ||
<Response effect="move_right" target="agent_0" /> | ||
</Event> | ||
<Event name="head_up"> | ||
<Trigger name="up_arrow" type="external" /> | ||
<Response effect="move_up" target="agent_0" /> | ||
</Event> | ||
<Event name="head_down"> | ||
<Trigger name="down_arrow" type="external" /> | ||
<Response effect="move_down" target="agent_0" /> | ||
</Event> | ||
</EventSystem> | ||
|
||
<State name="Stand" final="0" > | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="zero" /> | ||
</State> | ||
<State name="WalkLeft" final="0" > | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="const_dir" x="-1" y="0" /> | ||
</State> | ||
<State name="WalkRight" final="0" > | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="const_dir" x="1" y="0" /> | ||
</State> | ||
<State name="WalkUp" final="0" > | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="const_dir" x="0" y="-1" /> | ||
</State> | ||
<State name="WalkDown" final="0" > | ||
<GoalSelector type="identity" /> | ||
<VelComponent type="const_dir" x="0" y="1" /> | ||
</State> | ||
|
||
</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,46 @@ | ||
<?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" agent_force_strength="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.25" /> | ||
</Common> | ||
<PedVO factor="1.57" buffer="0.9" tau="3" tauObst="0.1" turningBias="1.0" /> | ||
<GCF stand_depth="0.18" move_scale="0.53" slow_width="0.25" sway_change="0.05" /> | ||
<Helbing mass="80" /> | ||
<Johansson fov_weight="0.16" /> | ||
<Karamouzas personal_space="0.69" anticipation="8" /> | ||
<ORCA tau="3.0" tauObst="0.15" /> | ||
<Zanlungo mass="80" /> | ||
</AgentProfile> | ||
|
||
<AgentGroup> | ||
<ProfileSelector type="const" name="group1" /> | ||
<StateSelector type="const" name="Stand" /> | ||
<Generator type="explicit"> | ||
<Agent p_x="0" p_y="0" /> | ||
</Generator> | ||
</AgentGroup> | ||
|
||
|
||
<ObstacleSet type="explicit" class="1"> | ||
<Obstacle closed="1" > | ||
<Vertex p_x = "0" p_y = "5"/> | ||
<Vertex p_x = "5" p_y = "0"/> | ||
<Vertex p_x = "0" p_y = "-5"/> | ||
<Vertex p_x = "-5" p_y = "0"/> | ||
</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,14 @@ | ||
<?xml version="1.0"?> | ||
|
||
<View width="530" height="530" > | ||
<!-- Multiple cameras are mapped to a key from 1-9 in the order they are defined here --> | ||
<Camera xpos="-0.235762" ypos="9.12995" zpos="0.060852" xtgt="-0.235762" ytgt="-5.56976e-05" ztgt="0.050852" far="400" near="0.01" fov="0.0" orthoScale="0.78749" /> | ||
|
||
<!-- 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> |
File renamed without changes.
Binary file not shown.
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
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
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
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
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
Oops, something went wrong.