O --- O
libPEDSIM Documentation
O --- O
2-Dimensional Visualizer

The 2-dimensional visualizer is a separate application that can be used to visualize the output of a PEDSIM simulation run. It listens on a network socket for update information (agent positions, but also dynamic scene definitions.), which are rendered in real-time. This is perfectly suited to observe stand-allone simulations or optimizations which take a long time to run. Also nice for demonstrations, where the visualizer is installed on the machine connected to the beamer, and the simulation runs on a separate host. Ah and yes, it is able to output png files for each frame, which can be combined into a video easily!

2dvis is built on Qt. If you want to use all the features (especially charts), you need Qt 5.7 or above. It should be possible to compile it using an older version. However, you will not see the metrics charts in 2dvis then. See documenation for compiling on Linux and Windows.


Usage: ./2dvis [options]
2-dimensional PEDSIM visualizer.
-h, --help Displays this help.
-q, --quiet Do not show graphical output
-n, --network <port> Read input from network on port <port>
-f, --file <file> Read input from <file>
-c, --charts Display charts DockWidget
-m, --metrics Display metrics DockWidget
-o, --outputdirectory <directory> Write frame-by-frame image output to <directory>

Usually, 2dvis is started in network mode, where it listens to incoming data packets on the specified UDP port.

./2dvis -n 2222

Metrics and charts display

2dvis has the ability to display user-defined metrics coming from the simulation. It can display the latest metrics in numerical form, and also chart the values as line graphs. These two dockable windows are enabled by specifying -m/--metrics or -c/--charts respectively on the command line. Note that the charts window needs Qt version 5.7 or above. Otherwise the feature will not be compiled in. Numerical metrics work for all Qt versions.

These metrics are submitted from the simulation using Ped::XMLOutputWriter::writeMetrics(std::unordered_map<std::string, std::string> hash). For example like this:

ow->writeMetrics({{"name1", "value1"}, {"name2", "value2"}});

Here is an example with metrics transmitted:

{"Average Timesteps", std::to_string(sum_age/agents.size())},
{"Average Theta", std::to_string(sum_theta/agents.size())},
{"Average Sensitivity L", std::to_string(sum_sensitivity_l/agents.size())},
{"Average Sensitivity R", std::to_string(sum_sensitivity_r/agents.size())},
{"Average Reach", std::to_string(sum_reach/agents.size())}
2dvis is a 2-dimensional visualizer for PEDSIM

Video generation

Instead of a network stream it is also possible to process a XML file containing the messages. This is meant for creating videos. At the moment, 2dvis will try to play all events in full speed, resulting in an overloaded graphics engine. Use it together with the -o output option only. This mode can be specified using

./2dvis -f filename.xml

In order to generate a video sequence out of a PEDSIM run, use these steps:

./2dvis -f ../../libpedsim/examples/pedsim_out.txt -o output
mencoder mf://output/*.png -mf w=1280:h=720:fps=25:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vbitrate=6000 -oac copy -o example01.avi

Find more about mencoder, which is part of the mplayer suite, here.

For example videos, see PEDSIM's YouTube channel.

Supported XML tags

See here for a list of supported XML tags.

2dvis is a 2-dimensional visualizer for PEDSIM
O --- O

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