Repeatedly picks two random waypoints and replaces the path between them with a straight segment when that segment is valid. The path length never increases. Endpoints are preserved.
Examples
planner <- robot_planner(validity = function(q) TRUE,
bounds = rbind(c(0, 1), c(0, 1)), algorithm = "rrt")
plan <- robot_plan(planner, c(0, 0), c(1, 1), seed = 3)
robot_shortcut(plan, seed = 3)$length <= plan$length
#> [1] TRUE