Presentation is loading. Please wait.

Presentation is loading. Please wait.

Workshop 1: Crowd Simulation Software & Collision Avoidance

Similar presentations


Presentation on theme: "Workshop 1: Crowd Simulation Software & Collision Avoidance"— Presentation transcript:

1 Workshop 1: Crowd Simulation Software & Collision Avoidance
Wouter van Toll Path Planning course September 17, 2015

2 Workshop 1: Crowd Simulation Software & Collision Avoidance
Goal of this workshop Theory Understand the various crowd simulation levels Gain insights in collision avoidance Think about (CA) experiments Practice Reduce your fear of C++ Know how our framework is structured Prepare for Assignment 2 December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

3 Workshop 1: Crowd Simulation Software & Collision Avoidance
Outline Introduction Framework demo Collision avoidance Create a basic model Advanced models + demo A bit on C++ Framework implementation Assignment 2 Compare collision avoidance methods December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

4 Workshop 1: Crowd Simulation Software & Collision Avoidance
Crowd simulation framework Introduction December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

5 Crowd simulation framework
December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

6 Workshop 1: Crowd Simulation Software & Collision Avoidance
4: Global path planning We use the Explicit Corridor Map Compact navigation mesh Supports any character radius Multi-layered environments Dynamic updates Other options could also work As long as the result is an indicative route December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

7 Workshop 1: Crowd Simulation Software & Collision Avoidance
3: Path following Indicative Route Method (IRM, 2009) Input: indicative route, non-smooth indication of the path In each simulation step, compute an attraction point Leads to a preferred velocity for the next level MIRAN (#7): improvement by Jaklin et al. (2013) Supports weighted regions Better smoothness/shortcut control December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

8 Workshop 1: Crowd Simulation Software & Collision Avoidance
Main idea Let the character roughly move in its preferred direction... ...while avoiding collisions with others Many ways to do this Lots of (ongoing) research How to evaluate? Big focus of the course More after the demo! December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

9 Workshop 1: Crowd Simulation Software & Collision Avoidance
The ECM framework in action Demo December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

10 Workshop 1: Crowd Simulation Software & Collision Avoidance
December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

11 Workshop 1: Crowd Simulation Software & Collision Avoidance
Level 2 of the crowd simulation framework Collision avoidance December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

12 Workshop 1: Crowd Simulation Software & Collision Avoidance
Main task A character has a preferred velocity Choose a (preferably similar) velocity that avoids collisions Trade-off between quality and efficiency? We want to simulate lots of characters in real-time We have to approximate using assumptions General assumptions Detached from global planning Characters are disks (?) ... December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

13 What makes a method good?
You’ve seen games with CA errors Which factors do you think are important? Character’s properties: velocity, size, psychological parameters, personal space, collision shape, … Obstacles in the environment Knowledge about movements of other characters Heterogeneous characters Social rules, group behavior Collision handling Smoothness Coordination between characters/groups ... December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

14 Workshop 1: Crowd Simulation Software & Collision Avoidance
Try it: 2 characters Given: 2 characters C1 and C2 Radius C1.r and C2.r Position C1.pos and C2.pos Current velocity C1.v and C2.v Preferred velocity C1.vpref and C2.vpref Think of an algorithm that avoids a collision Which main approach do you choose? Work in pairs (without colliding) December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

15 Workshop 1: Crowd Simulation Software & Collision Avoidance
Try it: n characters Given: n characters { C0 ... Cn-1 } Radius Ci.r Position Ci.pos Current velocity Ci.v Preferred velocity Ci.vpref Think of an algorithm such that C0 avoids all others Which main approach do you choose? December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

16 Workshop 1: Crowd Simulation Software & Collision Avoidance
Existing directions Force-based (Helbing #9, Reynolds #8) F = collision forces + social forces + attraction forces + ... dv/dt = F/m dp/dt = v Velocity-based (van den Berg #12, Karamouzas #13) Characters actively choose a new v Assumed to be “solving all problems” Hybrid (Moussaïd #34) Characters actively choose a desired velocity vdes Forces can still be added, e.g. in case of collisions dv/dt = F/m + (vdes - v) / τ December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

17 Workshop 1: Crowd Simulation Software & Collision Avoidance
Circle Demo December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

18 Workshop 1: Crowd Simulation Software & Collision Avoidance
Verdict Based on this demo: what do you think? Karamouzas is more predictive Moussaïd has better collision handling Karamouzas can converge without finishing ORCA is theoretically perfect, but may not be natural A general conclusion? Metrics: How do you measure “goodness”? Scenarios: Different environments, crowd sizes, ... Papers #30 and #31 on validation Validation is getting bigger “How can I be sure that your method is realistic?” December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

19 Workshop 1: Crowd Simulation Software & Collision Avoidance
Metrics and Scenarios What metrics could be used to compare CA algorithms? Path length Time to reach the goal Total rotation Total acceleration/deceleration Number/length of collisions ... Ideal: measure similarity to human behavior? December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

20 Workshop 1: Crowd Simulation Software & Collision Avoidance
Metrics and Scenarios What scenarios could be used to compare CA algorithms? Two opposing characters (position swap) Two opposing flows Overtaking characters Circle, square: variable size, number of characters Randomly distributed characters Narrow passages? Obstacles? ... But even with the right metrics and scenarios... ...“paper vs. implementation” December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

21 Paper vs. Implementation
December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

22 Paper vs. Implementation
It’s hard to judge a method in practice Not all parameter settings are well described Lots of details are up to the programmer Some necessary hacks are not mentioned Small changes can have huge impacts It helps if the software is available Then at least there’s one “ultimate” version Does it match the paper? Does it fit into your software? December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

23 Workshop 1: Crowd Simulation Software & Collision Avoidance
Or actually multiple bytes A bit on c++ December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

24 Framework implementation
Crowd simulation in the ECM Framework Framework implementation December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

25 Workshop 1: Crowd Simulation Software & Collision Avoidance
Software overview Libraries for different components ECM, environment, simulation, geometry, visualization, ... External libraries: Boost, OpenGL Demo projects Demo_ECMGenerator and Demo_ECMSimulation DLL Easy to link to other software, e.g. Unity Documentation: Doxygen Code comments generate nice HTML pages Version control: Mercurial December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

26 Single simulation step
Core of the crowd simulation engine performStep(Δt) Increase total time by Δt For each character: path following Update pointers along indicative route (if any) Compute new attraction point, preferred velocity For each character: collision avoidance Compute new velocity vNew Smoothen vNew (optional) Compute collision forces F (optional) For each character Update velocity: v := vNew + Δt · F/mass Update position: p := p + Δt · v Update nearest-neighbor data structure Why separate loops? Order of characters does not matter Characters are independent, each loop can be parallellized December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

27 Workshop 1: Crowd Simulation Software & Collision Avoidance
Game loop Update the simulation per time step: performStep(Δt) Possible approach: do as many steps as possible Use time between frames as step size Use FPS to measure efficiency Is this a good idea? We use a fixed time step (0.1 s) Use computation time to measure efficiency (e.g. % of step time) Behavior does not depend on the framerate Fast-forward by calling performStep() more/less often You really don’t need a higher simulation framerate Visual framerate can be much higher (Not in our demo) December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

28 Class example: path planning
Similar for PathFollowing and CollisionAvoidance PathFollowingMethod: compute new attraction point Children: IRM and MIRAN CollisionAvoidanceMethod: compute a good new velocity Children: VelocityBased, VisionBased, RVO PathPlanningMethod - Type - const Environment* PathPlanningResult* planPath(const Character&) PathPlanningResult - IndicativeRoute - vector<int> ecmVertices - TimedPath PP_GridBased PP_ECMBased Corridor computeECMRoute(Character&) IndicativeRoute computeIR(Character&, const Corridor&) A* on the ECM  corridor Different ways to extract IR from a corridor PP_ECM_MedialAxis PP_ECM_ShortPath ... December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

29 CollisionAvoidanceManager
Design patterns General OO programming tricks You may already be using them without knowing it Singleton: class that can have only 1 instance I use them for managers of implementations Chooses the correct CAMethod per character Manager is an unofficial & disliked pattern What does it “manage”? Many design patterns exist Someone will always know better Find a balance, do what you think is useful CollisionAvoidanceManager - vector<CAMethod*> void updateVelocity(Character&) December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

30 Workshop 1: Crowd Simulation Software & Collision Avoidance
Adding RVO2 to the framework Assignment 2 December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

31 Workshop 1: Crowd Simulation Software & Collision Avoidance
Assignment 2 details Compare CA algorithms in our framework Velocity-based (Karamouzas et al.) Vision-based (Moussaïd et al.) ORCA (van den Berg et al.) Choose wisely Which scenarios do you use? Which metrics do you use? Try different parameter settings Draw careful conclusions Watch out for “paper vs. implementation” Bonus points? Add other CA algorithms December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

32 Workshop 1: Crowd Simulation Software & Collision Avoidance
Assignment 2 details Contact Roland for obtaining the code Account for our Mercurial server The code changes quite often Contact me for code questions/remarks Read the documentation first ;) December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

33 Workshop 1: Crowd Simulation Software & Collision Avoidance
Goal revisited Theory Understand the various crowd simulation levels Gain insights in collision avoidance Think about (CA) experiments Practice Reduce your fear of C++ Know how our framework is structured Prepare for Assignment 2 December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance

34 Workshop 1: Crowd Simulation Software & Collision Avoidance
Questions? Wouter van Toll BBG 4.17 (next to Roland) December 7, 2018 Workshop 1: Crowd Simulation Software & Collision Avoidance


Download ppt "Workshop 1: Crowd Simulation Software & Collision Avoidance"

Similar presentations


Ads by Google