O --- O
libPEDSIM Documentation
[HOME] [EXAMPLES] [ECOSYSTEM] [DOCUMENTATION] [DOWNLOAD]
O --- O
Scenario Definition

PedSim Demo App Documentation

Scenario Definition

The scenario of the simulation is defined in a simple XML file. The default is scene.xml, placed in the same directory as the executable. However, it can also be specified on the command line:

./pedsim myscenario.xml

There must be a top-level tag in each XML document. In the predefined scenario file scene.xml and in the examples, it is <scenario>. At this moment, it does not matter what you write in there - as long as you have exacly one top-level tag.

Waypoints

The first item you should define are the waypoints, because they are used later in the agent definitions.

A waypoint has coordinates x and y, and a raduis r. A waypoint definition also contains the waypoint id, which is used to reference it later:

<waypoint id="w1" x="-160" y="-51" r=" 17" />

Agents

Agent definitions are a bit more complex. An agent has a start position with coordinates x and y.

Since it would not be comfortable to define each of potentially many agents individually, there is a way to specify groups of agents. In the agent definition, a agent multiplier n can be added. N copies of that agent will be spawned into the simulation. It would not be wise to place them all at the same location, so there is a way to spread them out a bit by specifying the dx and dy modifiers. The agents will be placed evenly distributed between x-dx and x+dx (resp y and dy).

Each agent has waypoints assigned. It will walk from the initial position to the first waypoint, then to the second and so on. The waypoints are added inside the <agent></agent> tag. Each added waypoint is a reference to a waypoint defined earlier. Please make sure that only waypoints really specified earlier are referenced.

Example

<agent x="60" y="0" n="100" dx="70" dy="10">
     <addwaypoint id="w1"/>
     <addwaypoint id="w2"/>
</agent>

Obstacles

Defining obstacles is very simple. Each obstacle is a line from coordinates x1/y1 to coordinates x2/y2. It is not relevant where they are added, or how they are grouped.

<obstacle x1="-2" y1="-50" x2="2" y2="-50" />

Combined Example

A box of four walls is defined, a waypoint on each side. 200 agents walk from one side of the box to the other.

<scenario>
<waypoint id="wu" x="0" y="-100" r="50" />
<waypoint id="wd" x="0" y=" 100" r="50" />
<waypoint id="wl" x="-100" y="0" r="50" />
<waypoint id="wr" x=" 100" y="0" r="50" />
<agent x="0" y="0" n="100" dx="90" dy="90">
<addwaypoint id="wu" />
<addwaypoint id="wd" />
</agent>
<agent x="0" y="0" n="100" dx="90" dy="90">
<addwaypoint id="wl" />
<addwaypoint id="wr" />
</agent>
<obstacle x1="-110" y1="-110" x2=" 110" y2="-110" />
<obstacle x1=" 110" y1="-110" x2=" 110" y2=" 110" />
<obstacle x1=" 110" y1=" 110" x2="-110" y2=" 110" />
<obstacle x1="-110" y1=" 110" x2="-110" y2="-110" />
</scenario>

This is a screenshot of the DemoApp displaying this example scenario:

Pedsim Demo App
O --- O

⁠(c) Christian Gloor [ c|h|g|l|o|o|r|@|s|i|l|m|a|r|i|l|.|o|r|g| ]