Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Path shortcutting

Also known as shortcutting

optimization sampling-planning

Path shortcutting shortens a path that a planner found, for example a jagged RRT path. It replaces a piece of the path by one direct motion when that motion is valid. The greedy form, shortcut, jumps from each kept state to the furthest later state it can reach directly, so it only removes states. The random form, shortcut_random, picks two random points along the path and splices in the direct motion between them if it is valid and cheaper, so it also cuts corners. Both never return a more expensive path, but the result is only locally better, not optimal; a max_edge bound limits the length of the new edges.

Pseudocode

algorithm Shortcut(P, e-max)input: path P = ⟨p₀, …, p_m⟩, longest allowed new edge e-maxoutput: a valid path no more expensive than PK ← ⟨⟩i ← 0while i < m doappend(K, p_i)j ← largest j > i + 1 with d(p_i, p_j) ≤ e-max and motion-valid(p_i, p_j), else i + 1i ← jappend(K, p_m)return cheaper of K and Pfunction Shortcut-Random(P, e-max, k)input: path P, longest allowed new edge e-max, number of attempts koutput: a valid path no more expensive than PQ ← Pfor t in 1, …, k doif |Q| < 3 thenbreaka, b ← two random points on Q by arc length, a before bQ′ ← Q with the piece from a to b replaced by the motion a → bif d(a, b) ≤ e-max and the three new motions of Q′ are valid and cost(Q′) < cost(Q) thenQ ← Q′return cheaper of Q and P

In the crates