Skip to content

Commit 65afabb

Browse files
Hayato-HessSimon RahnHayato Hess
authored
Add Vadere trajectory loader (#460)
* Add trajectory loader for Vadere trajectory (postvis.traj) files * Refactor trajectory_loader for Vadere trajectories * Refactor using scripts/format.sh * Add test_load_trajectory_from_vadere_no_data * Add test_load_trajectory_from_vadere_reference_file including reference file (created with Vadere 3.0, d79a4bfd) * Fix unstable floating point operations in trajectory_loader * Add test_load_trajectory_from_vadere_success * Group vadere test functions * Add tests for missing and non-unique columns in vadere trajectory files * Refactor using scripts/format.sh * Refactoring Removed commented code * Add load_trajectory_from_vadere to __init__.py * Add Vadere example to jupyter notebook * Add scenario and trajectory file * Update user_guide.ipynb * Add draft for load_walkable_area_from_vadere_scenario * Update vadere scenario and trajectory files * Add walkable area for Vadere to user guide jupyter notebook * Simplify the way how the Vadere bounding box is loaded to PedPy * Update jupyter notebook * Add decimal places as input variable This allows us to explicitly handle floating point errors that occur when transforming walkable areas and shapely polygons * Add test_load_walkable_area_from_vadere_scenario * Refactor error messages and syntax * Correct input argument that leads to error * Fix walkable area test with margin in test_trajectory_loader Previously, the margin added to coordinates was ignored, causing the resulting polygons to fail the equality check. * Remove load_trajectory_from_vadere frame_rate default value As there is no meaning of a frame rate of 24 in Vadere, we decided to remove this default value. Thus making it more transparent to the users that this needs to be passed to the function explicitly. * Improve load_trajectory_data_from_vadere error message when required fields are missing * Add ignore_too_short_trajectories flag to load_trajectory_from_vadere This new flag allows users to control how short trajectories are handled. By default, ignore_too_short_trajectories is set to False. In this case, if a trajectory is too short for the specified frame rate, an error is raised. If the flag is set to True, a warning is logged instead, and the short trajectory is ignored. * Remove inplace=True calls From the ruff linter: PD002 inplace=True should be avoided; it has inconsistent behavior * Remove default frame_rate of zero from write_vadere_csv_file * Support overlapping obstacles when loading Vadere walkable areas based on suggestion by @schroedtert: #382 (comment) * Reformat Vadere trajectory code * Improve Vadere trajectory import code quality (PR-460) --------- Co-authored-by: Simon Rahn <simon.rahn@hm.edu> Co-authored-by: Hayato Hess <gasi04hi@hm.edu>
1 parent c4db542 commit 65afabb

11 files changed

Lines changed: 3140 additions & 4 deletions

File tree

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
{
2+
"name" : "bottleneck",
3+
"description" : "",
4+
"release" : "3.0",
5+
"commithash" : "d79a4bfd2394cfa6fc92372d2ebd1b117ab9a2da",
6+
"processWriters" : {
7+
"files" : [ {
8+
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
9+
"filename" : "postvis.traj",
10+
"processors" : [ 1, 2 ]
11+
} ],
12+
"processors" : [ {
13+
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FootStepProcessor",
14+
"id" : 1
15+
}, {
16+
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FootStepTargetIDProcessor",
17+
"id" : 2
18+
} ],
19+
"isTimestamped" : false,
20+
"isWriteMetaData" : true
21+
},
22+
"scenario" : {
23+
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
24+
"attributesModel" : {
25+
"org.vadere.state.attributes.models.AttributesOSM" : {
26+
"stepCircleResolution" : 4,
27+
"numberOfCircles" : 1,
28+
"optimizationType" : "NELDER_MEAD",
29+
"varyStepDirection" : true,
30+
"movementType" : "ARBITRARY",
31+
"stepLengthIntercept" : 0.4625,
32+
"stepLengthSlopeSpeed" : 0.2345,
33+
"stepLengthSD" : 0.036,
34+
"movementThreshold" : 0.0,
35+
"minStepLength" : 0.1,
36+
"minimumStepLength" : true,
37+
"maxStepDuration" : 1.7976931348623157E308,
38+
"dynamicStepLength" : true,
39+
"updateType" : "EVENT_DRIVEN",
40+
"seeSmallWalls" : false,
41+
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
42+
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
43+
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
44+
"submodels" : [ ]
45+
},
46+
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
47+
"pedPotentialIntimateSpaceWidth" : 0.45,
48+
"pedPotentialPersonalSpaceWidth" : 1.2,
49+
"pedPotentialHeight" : 50.0,
50+
"obstPotentialWidth" : 0.8,
51+
"obstPotentialHeight" : 6.0,
52+
"intimateSpaceFactor" : 1.2,
53+
"personalSpacePower" : 1,
54+
"intimateSpacePower" : 1
55+
},
56+
"org.vadere.state.attributes.models.AttributesFloorField" : {
57+
"createMethod" : "HIGH_ACCURACY_FAST_MARCHING",
58+
"potentialFieldResolution" : 0.1,
59+
"obstacleGridPenalty" : 0.1,
60+
"targetAttractionStrength" : 1.0,
61+
"cacheType" : "NO_CACHE",
62+
"cacheDir" : "",
63+
"timeCostAttributes" : {
64+
"standardDeviation" : 0.7,
65+
"type" : "UNIT",
66+
"obstacleDensityWeight" : 3.5,
67+
"pedestrianSameTargetDensityWeight" : 3.5,
68+
"pedestrianOtherTargetDensityWeight" : 3.5,
69+
"pedestrianWeight" : 3.5,
70+
"queueWidthLoading" : 1.0,
71+
"pedestrianDynamicWeight" : 6.0,
72+
"loadingType" : "CONSTANT",
73+
"width" : 0.2,
74+
"height" : 1.0
75+
}
76+
}
77+
},
78+
"attributesSimulation" : {
79+
"finishTime" : 50.0,
80+
"simTimeStepLength" : 0.4,
81+
"realTimeSimTimeRatio" : 0.1,
82+
"writeSimulationData" : true,
83+
"visualizationEnabled" : true,
84+
"printFPS" : false,
85+
"digitsPerCoordinate" : 2,
86+
"useFixedSeed" : true,
87+
"fixedSeed" : 98957596352036733,
88+
"simulationSeed" : 98957596352036733
89+
},
90+
"attributesPsychology" : {
91+
"usePsychologyLayer" : false,
92+
"psychologyLayer" : {
93+
"perception" : "SimplePerceptionModel",
94+
"cognition" : "SimpleCognitionModel",
95+
"attributesModel" : {
96+
"org.vadere.state.attributes.models.psychology.perception.AttributesSimplePerceptionModel" : {
97+
"priority" : {
98+
"1" : "InformationStimulus",
99+
"2" : "ChangeTargetScripted",
100+
"3" : "ChangeTarget",
101+
"4" : "Threat",
102+
"5" : "Wait",
103+
"6" : "WaitInArea",
104+
"7" : "DistanceRecommendation"
105+
}
106+
},
107+
"org.vadere.state.attributes.models.psychology.cognition.AttributesSimpleCognitionModel" : { }
108+
}
109+
}
110+
},
111+
"topography" : {
112+
"attributes" : {
113+
"bounds" : {
114+
"x" : 0.0,
115+
"y" : 0.0,
116+
"width" : 8.0,
117+
"height" : 10.0
118+
},
119+
"boundingBoxWidth" : 0.5,
120+
"bounded" : true,
121+
"referenceCoordinateSystem" : null
122+
},
123+
"obstacles" : [ {
124+
"id" : 5,
125+
"shape" : {
126+
"type" : "POLYGON",
127+
"points" : [ {
128+
"x" : 0.5,
129+
"y" : 3.5
130+
}, {
131+
"x" : 0.5,
132+
"y" : 3.0
133+
}, {
134+
"x" : 3.0,
135+
"y" : 3.0
136+
}, {
137+
"x" : 3.0,
138+
"y" : 2.5
139+
}, {
140+
"x" : 3.5,
141+
"y" : 2.5
142+
}, {
143+
"x" : 3.5,
144+
"y" : 3.0
145+
}, {
146+
"x" : 3.5,
147+
"y" : 3.5
148+
}, {
149+
"x" : 3.0,
150+
"y" : 3.5
151+
} ]
152+
},
153+
"visible" : true
154+
}, {
155+
"id" : 6,
156+
"shape" : {
157+
"type" : "POLYGON",
158+
"points" : [ {
159+
"x" : 7.5,
160+
"y" : 3.5
161+
}, {
162+
"x" : 5.0,
163+
"y" : 3.5
164+
}, {
165+
"x" : 4.5,
166+
"y" : 3.5
167+
}, {
168+
"x" : 4.5,
169+
"y" : 3.0
170+
}, {
171+
"x" : 4.5,
172+
"y" : 2.5
173+
}, {
174+
"x" : 5.0,
175+
"y" : 2.5
176+
}, {
177+
"x" : 5.0,
178+
"y" : 3.0
179+
}, {
180+
"x" : 7.5,
181+
"y" : 3.0
182+
} ]
183+
},
184+
"visible" : true
185+
} ],
186+
"measurementAreas" : [ ],
187+
"stairs" : [ ],
188+
"targets" : [ {
189+
"id" : 8,
190+
"shape" : {
191+
"x" : 6.4,
192+
"y" : 1.0,
193+
"width" : 0.6,
194+
"height" : 1.0,
195+
"type" : "RECTANGLE"
196+
},
197+
"visible" : true,
198+
"absorber" : {
199+
"enabled" : true,
200+
"deletionDistance" : 0.1
201+
},
202+
"waiter" : {
203+
"enabled" : false,
204+
"distribution" : null,
205+
"individualWaiting" : true
206+
},
207+
"leavingSpeed" : -1.0,
208+
"parallelEvents" : 0
209+
} ],
210+
"targetChangers" : [ ],
211+
"absorbingAreas" : [ ],
212+
"aerosolClouds" : [ ],
213+
"droplets" : [ ],
214+
"sources" : [ {
215+
"id" : 1,
216+
"shape" : {
217+
"x" : 1.0,
218+
"y" : 5.0,
219+
"width" : 6.0,
220+
"height" : 4.0,
221+
"type" : "RECTANGLE"
222+
},
223+
"visible" : true,
224+
"targetIds" : [ 8 ],
225+
"spawner" : {
226+
"type" : "org.vadere.state.attributes.spawner.AttributesRegularSpawner",
227+
"constraintsElementsMax" : -1,
228+
"constraintsTimeStart" : 0.0,
229+
"constraintsTimeEnd" : 0.0,
230+
"eventPositionRandom" : true,
231+
"eventPositionGridCA" : false,
232+
"eventPositionFreeSpace" : true,
233+
"eventElementCount" : 20,
234+
"eventElement" : null,
235+
"distribution" : {
236+
"type" : "org.vadere.state.attributes.distributions.AttributesConstantDistribution",
237+
"updateFrequency" : 1.0
238+
}
239+
},
240+
"groupSizeDistribution" : [ 1.0 ]
241+
} ],
242+
"dynamicElements" : [ ],
243+
"attributesPedestrian" : {
244+
"shape" : {
245+
"x" : 0.0,
246+
"y" : 0.0,
247+
"width" : 1.0,
248+
"height" : 1.0,
249+
"type" : "RECTANGLE"
250+
},
251+
"visible" : true,
252+
"radius" : 0.2,
253+
"densityDependentSpeed" : false,
254+
"speedDistributionMean" : 1.34,
255+
"speedDistributionStandardDeviation" : 0.26,
256+
"minimumSpeed" : 0.5,
257+
"maximumSpeed" : 2.2,
258+
"acceleration" : 2.0,
259+
"footstepHistorySize" : 4,
260+
"searchRadius" : 1.0,
261+
"walkingDirectionSameIfAngleLessOrEqual" : 45.0,
262+
"walkingDirectionCalculation" : "BY_TARGET_CENTER"
263+
},
264+
"teleporter" : null
265+
},
266+
"stimulusInfos" : [ ]
267+
}
268+
}

0 commit comments

Comments
 (0)