Commit 53b14240 authored by Fabien Grzeskowiak's avatar Fabien Grzeskowiak

python viz (wip)

parent 091aeca9
......@@ -3,4 +3,5 @@
<!-- <configPath path="examples/FOEAvoidance/FOEAvoidanceExample.xml"/> -->
<!-- <configPath path="examples/PowerLaw/PowerLawExample.xml"/> -->
<!-- <configPath path="examples/Toric2/config.xml"/> -->
<configPath path="examples/Toric2/config.xml"/>
\ No newline at end of file
<!-- <configPath path="examples/Toric2/config.xml"/> -->
<configPath path="examples/Toric3/config.xml"/>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Simulation delta_time="0.033" iterations="1000" world_type="Toric" world_size="15"/>
<World>
<Policies>
<Policy id="0">
<costfunction name="DirectionalGoalReaching" coeff="0.5"/>
<costfunction name="FOEAvoidance" coeff="3"/>
<costfunction name="SocialForcesAvoidance" coeff="0.6"/>
<costfunction name="RandomFunction" coeff="0.01"/>
</Policy>
</Policies>
<Agents>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="15" y="0.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="16" y="1.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="17" y="2.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="18" y="3.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="19" y="4.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="20" y="0.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="21" y="1.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="16" y="2.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="18" y="3.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="17" y="4.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="19" y="0.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="17" y="1.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="14" y="2.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="13" y="3.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="19" y="4.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="6" y="0.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="6" y="1.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="5" y="2.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="18" y="3.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="8" y="4.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="7" y="0.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="3" y="1.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="5" y="2.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="9" y="3.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="7" y="4.1"/>
<goal x="-100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-5" y="0"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-8" y="1"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-2" y="2"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="3" y="4"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-10" y="1"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-12" y="0"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-7" y="1"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-10" y="2"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-8" y="3"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-7" y="4"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-12" y="0"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-9" y="1"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-9" y="2"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-6" y="3"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-10" y="2"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-5" y="0"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-9" y="1"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-3" y="2"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-2" y="3"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-9" y="4"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-1" y="0"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-4" y="1"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-1" y="2"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-7" y="3"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
<Agent rad="0.5" pref_speed="2" max_speed="3">
<pos x="-2" y="4"/>
<goal x="100" y="0"/>
<Policy id="0"/>
</Agent>
</Agents>
</World>
This diff is collapsed.
import pandas as pd
import os
import matplotlib.pyplot as plt
import matplotlib.animation as anim
files = os.listdir("./output")
df_ref = pd.read_csv("./output/"+files[0])
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
def animate(i):
for i in range(0,df_ref.shape[0]):
plt.clf()
for name in files:
df = pd.read_csv("./output/"+name)
ax1.clear()
ax1.plot(df.iloc[i][1],df.iloc[i][2],'bo')
ani = anim.FuncAnimation(fig, animate, interval = 1000)
plt.show()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment