Title: Toward More Realistic Pathfinding
1Toward More Realistic Pathfinding
2Path finding
- How do people find paths?
- Local knowledge
- Go downhill
- Follow the person in front of you
- Follow the scent of food
- Global knowledge
- Consider all possible paths from start to goal
- Assign a cost to each leg of the path
- Find path to goal with smallest cost
Continuous
Discrete
3Algorithms for path finding
- Uniformed
- You dont have any insight other than whats
immediately before you - Informed
- You have some insight, or heuristics that help
you choose where to explore
4Path finding data structures
- Commonly used data structures
- Start where the search must begin
- Goal where the search must terminate
- Fringe locations in the world that define the
boundary of knowledge about the paths from Start
to Goal
5Uniformed search Uniform-Cost Search
- Always expand the lowest-path-cost node
- Dont evaluate the node until it is expanded
not when it is the result of expansion
6Uniform-Cost Search
- Fringe S0
- Expand(S) ? A1, B5, C15
7Uniform-Cost Search
- Fringe A1, B5, C15
- Expand(A) G11
8Uniform-Cost Search (review)
- Fringe B5, G11, C15
- Expand(B) ? G10
9Uniform-Cost Search (review)
- Fringe G10, C15
- Expand(G) ? Goal
10Best-first Search
- Uniform-cost search explored the node that was
the closest - With disregard for how far it was from the goal
- because we didnt know that information
- What if we knew something about the remaining
distance to the goal? - How could we take this into account?
- The best node on fringe to explore is one that
balances cost to reach and cost to goal
11Evaluation function f(n)
- Combine two costs
- f(n) g(n) h(n)
- g(n) cost to get from start to n
- h(n) cost to get to from n to goal
12Heuristics
- A function, h(n), that estimates cost of cheapest
path from node n to the goal - h(n) 0 if n goal node
13A (A-star) Search
- Dont simply minimize the cost to intermediate
state on fringe minimize the cost from start to
goal - f(n) g(n) h(n)
- g(n) cost to get to n from start
- h(n) cost to get from n to goal
- Select node from fringe that minimizes f(n)
14A is Optimal?
- A can be optimal if h(n) satisfies conditions
- h(n) never overestimates cost to reach the goal
- it is eternally optimisic
- f(n) never overestimates cost of a solution
through n
15A is Optimal
- We must prove that A will not return a
suboptimal goal or a suboptimal path to a goal - Let G be a suboptimal goal node
- f(G) g(G) h(G)
- h(G) 0 because G is a goal node
- f(G) g(G) gt C (because G is suboptimal)
16A is Optimal
- We must prove that A will not return a
suboptimal goal or a suboptimal path to a goal - Let G be a suboptimal goal node
- f(G) g(G) h(G)
- h(G) 0 because G is a goal node
- f(G) g(G) gt C (because G is suboptimal)
- Let n be a node on the optimal path
- because h(n) does not overestimate
- f(n) g(n) h(n) lt C
- Therefore f(n) lt C lt f(G)
- node n will be selected before node G
17Contours
- Because f(n) is nondecreasing
- we can draw contours
- If we know C
- We only need to explore contours less than C
18Properties of A
- A expands all nodes with f(n) lt C
- A expands some (at least one) of the nodes on
the C contour before finding the goal - A expands no nodes with f(n) gt C
- these unexpanded nodes can be pruned
19A is Optimally Efficient
- No other optimal algorithm is guaranteed to
expand fewer nodes than A - (except perhaps eliminating consideration of ties
at f(n) C) - Compared to other algorithms using same heuristic
20Pros and Cons of A
- A is optimal and optimally efficient
- A is still slow and bulky (space kills first)
- Number of nodes grows exponentially with the
length to goal - This is actually a function of heuristic, but
they all have errors - A must search all nodes within this goal contour
- Finding suboptimal goals is sometimes only
feasible solution
21A for video games
- Is very common
- It will find a path from start to goal
- The world is spatially discretized
- Produces zigzag effect between cells
- Does not produce smooth turns
- Does not check for illegal moves or for abrupt
turning when a unit has a particular turning
radius
22Removing the Zigzag Effect
Can just associate a cost with each turn, but
that does not solve the problem entirely. A
better smoothing process is to remove as many
waypoints as possible.
23Removing the Zigzag Effect
checkPoint starting point of pathcurrentPoint
next point in pathwhile (currentPoint-gtnext !
NULL)Â Â Â if Walkable(checkPoint,
currentPoint-gtnext)Â Â Â Â Â Â // Make a straight path
between those points      temp
currentPoint      currentPoint
currentPoint-gtnext      delete temp from the
path   else      checkPoint
currentPoint      currentPoint
currentPoint-gtnext
24Removing the Zigzag Effect
- Checks path from waypoint to waypoint. If the
path traveled intersects a blocked location, the
waypoint is not removed. Otherwise, remove the
waypoint. - Leaves impossible sections as is.
25Adding Realistic Turns
- Want to be aware of a units turning radius and
choose shortest route to destination, in this
case the right turn will lead to the shortest
route.
26Adding Realistic Turns
- Calculate the length of the arc plus the line
segment for both left and right turns. Shortest
path is the one to use.
27Adding Legal Turns
- Several Postprocess Solutions (cheats)
- Ignore blocked tiles obviously bad
- Path recalculations associate a byte with each
tile, each bit denoting the surrounding tiles as
legal or illegal may invalidate legal paths from
other directions bad - Decrease turning radius until it is legal bad
for units with constant turning radius (e.g.
truck), good for units such as people - Backing up make a three point turn good for
units such as trucks, weird for people
28Adding Legal Turns
- Problems
- Methods shown previously are basically cheats,
except for the second one (path recalculations),
which can fail to find valid paths - How can we make sure that paths taken are both
legal and do not violate the turning radius?
29Directional A
Sometimes the only legal path that does not
violate the turning radius constraints is
completely different from the path that the
standard A algorithm produces. To get around
this, Pinter proposes a modification known as
Directional A.
30Directional A
- First things first
- Add an orientation associated with each node,
where the orientation can be any one of the eight
compass directions - Each node now represented by three dimensions
x, y, orientation
31Directional A
- Check the path from a parent to a child node, not
just whether or not the child is a blocked tile - Consider the orientation at parent and child
nodes as well as the turning radius and size of
the unit to see if path hits any blocked tiles - Result a valid path given the size and turning
radius of the unit
32Directional A
Directional A does not go directly from a to c
because it sees that an abrupt left turn would
cause the unit to hit blocked tiles. Thus,
waypoint b is found as the shortest legal path.
33Directional A
- Problem adding an end orientation
- Four common paths
34Directional A
- Can easily compute the four common paths and
choose the shortest one - Can add smoothing algorithm presented earlier,
with the modification of sampling points along a
valid curve between two points rather than just a
straight line between two points
35Expanding the Search
- So far, have been using a Directional-8 search
- Some paths will fail under this method
- Try searching more than one tile away
- Directional-24 search two tiles away, rarely
fails to find a valid path - Directional-48 search three tiles away, almost
never fails to find a valid path
36Modifying the Heuristic
- Standard A measures straight line distance from
start to goal - Modify so that it measures the shortest curve and
line segment as calculated earlier, considering
turn radius - If units can go in reverse, consider adding a
cost penalty to encourage units to move in
reverse only when necessary
37Directional A Limitations
- Very slow, constantly uses tables as a means to
optimize it (directional table, heuristic table,
hit-check table, etc) - Directional-48 may still possibly (though rarely)
fail - The four common paths from origin to destination
are not the only ones there is an infinite
number of paths
38More Optimizations
- Timeslice the search
- Only use Directional-24 and -48 if a
Directional-8 fails - Divide map into regions and pre-compute whether a
tile in one region can reach a tile in another - Use two matrices to calculate intermediate search
results, one for slow, timesliced searches and
the other for faster searches
39Summary
- Directional A finds legal paths and realistic
turns - Directional A is slow
- Examples only take into account a 2D space
partitioned into a grid, but can be extended to
support various partitioning methods in 2D or 3D - Suggest standard A for most units and
Directional A for various large units
40Realistic Human Walking Paths
- David C. Brogan
- Computer Science DepartmentUniversity of Virginia
Nicholas L. Johnson School of InformationUniversi
ty of Michigan
41Motivation for walking characters
- Scientific and Entertainment Applications
Helbing et al. Escape Panic
Helbing et al. Trails
Phantom Menace
42Realistic walking paths
- Dynamics matters!
- Walking dynamics influence what path is generated
- Can I cut the corner to dart down the hallway?
- Following a path influences walking dynamics
- I must slow down to cut the corner
- What a character can do influences what it does
43Background
- Robotics, Animation, Practitioners
- Reactive Control
- Reynolds steering behaviors
- Planning
- Bandi and Thalmann A method
- Example-based
- Choi, Lee, and Shin motion capture library
44What do realistic paths look like?
- An empirical question
- 36 people performed walking experiments
- convenience sample of passersby (unpaid)
- Video taped and rotoscoped for path acquisition
45Five walking experiments
- Carry piece of paper from A to B
- Return to A andrepeat 3 times
- 7 paths generated
46Five walking experiments
47Five walking experiments
48Five walking experiments
- Sharp Turn
- 9 participants
49Five walking experiments
50Five walking experiments
51Empirical Observations
- Similar speed and acceleration profiles
- Presence of turning constraints
Limit on turning radius
Inertia
52Pedestrian model outline
- Discrete event simulation of Sim
- Calculate a desired speed
- Proximity to goal and obstacles
- Compute desired heading
- Obey turning constraints and avoid obstacles
- Integrate dynamics
- Obey inertial constraints
- Heavily influenced by experiments
53Calculate desired speed
- Nominal desired speed 1.36 m/s
- Linear acceleration from start during first 1.82
m - Linear deceleration to goal during final 1.63 m
- Desired speed near obstacle 1.10 m/s
- Linear speed modulation within 0.81 m
54Compute desired heading
55Compute desired heading
- Heading for each grid cell
- A function of turning constraints
- A function of walking dynamics
- A function of speed
- Shortest path to goal
- If speed were maintained
r
Compute headings for multiple turning constraints
56Heading for each grid cell
- Flood fill from goal
- Goal heading and position is known
57Heading for each grid cell
- Flood fill from goal
- Goal heading and position is known
58Heading for each grid cell
- Recursively flood fill fromeach subgoal
- Heading is overwritten if betterpath is found
59Heading for each grid cell
- Recursively flood fill fromeach subgoal
60Heading for each grid cell
- Recursively flood fill fromeach subgoal
61Heading for each grid cell
- Recursively flood fill fromeach subgoal
62Heading for each grid cell
- Recursively flood fill fromeach subgoal
63Heading for each grid cell
- After 2p / q iterations
- Subgoals trace a circle of radius, r
64Heading for each grid cell
- Recursively flood fill fromeach subgoal
65Heading for each grid cell
- Recursively flood fill fromeach subgoal
66Heading for each grid cell
67Heading for each grid cell
- Obstacles cause shadows
- Subgoal if
- Adjacent to obstacle
- and
- Adjacent to unlabeled grid cell (or grid cell
pointing to inferior subgoal)
68Heading for each grid cell
69Heading for each grid cell
70Heading for each grid cell
71Heading for each grid cell
72Heading for each grid cell
73Heading for each grid cell
- Obstacles cause shadows
- Some grid cells unlabeled
- r parameter is too high
- Create heading charts with multiple r values
74Walking dynamics
- Compute Sim turning radius, r
- According to speed and mass
- Look up heading from appropriate heading chart
- Reduce speed if no specified heading for grid
cell - Change speed according to schedules
- Influence of inertia
- Integrate Sim dynamics
75Turning Radius
- To maintain constant centripetal force
- Faster Sim requires larger r
- Assume constant ratio between mass and force
- Larger people exert larger forces
76Inertia
- Cannot instantly accomplish desired heading
- Weighted average of previous heading and desired
- cinertia and cturn tuned using experiments
77Validation
- Two experimental conditions
78Evaluation Metrics
- No perfect metric
- Distance error
- Momentary velocity error leads to sequence of
distance errors - Area error
- Ignores speed errors
- Speed error
- Ignores dissimilarity of paths
79Results
- Compared to A path planning model
- Cell size 0.04 m
- 20 heading charts, turning radii 0 to 1.5 m
Model Distance error Area error Speed error
Pedestrian model .3133 .0204 .2185
A .4683 .0389 .2536
80Results
- Compared to A path planning model
81Conclusion
- A method for generating realistic walking paths
- Parameterized from observations
- Shortest path subject to
- Turning limitations
- Inertia
82Future work
- Better understand evaluation metrics
- Distance is highly correlated to both area and
speed errors - Human path planning is complex
- Humans adjust velocity opportunistically during
path - Humans do not strive for shortest paths
- Computational techniques complement research from
biomechanists, perceptual psychologists, and
cognitive scientists
83Our goal
- Given
- Initial position, speed, facing direction
- Final position, speed, facing direction
- Accurate model of world
- Find
- Path
- satisfying boundary constraints
- providing realistic walking paths
84Building a walking path generator
- What can pedestrians do?
- Experimental evaluationof human performance
85Building a walking path generator
- What paths suit capabilities?
- Search for paths to goal subject to realistic
walking constraints
86Building a walking path generator
- Evaluation
- Validate pedestrian modelwith additional
experimentsand multiple metrics
87Participant characteristics
- Questionnaire results
- Age 23 (SD 6)
- Height 1.8 m (SD 0.078 m)
- Weight 75 kg (SD 15 kg)
- Shoulder Width 0.25 m (SD 0.31 m)
88Empirical Observations
- Similar speed profiles
- Mean maximum speed across all tests
- 1.36 m/s (N 285, SD 0.162 m/s)
- Mean speed at closest point to each obstacle
- 1.10 m/s (N 308, SD 0.143 m/s)
89Empirical observations
- Similar acceleration profiles
- Deceleration begins 1.63 m from goal
- Acceleration stops at 1.82 m from start
- Measured using Hi-Ball tracker in straight-line
walking
90Empirical observations
- Turning constraints
- Limit on radius
Inertia
91Pedestrian model goal
- Given
- Final position, speed, heading
- Accurate model of world
- Find
- Path
- From any initial position
- Satisfying boundary constraints
- Providing realistic walking paths
92Validation
- Two experimental conditions
- Hidden camera
- 30 participants
- Digitized paths