Optimization Objectives
The OMPL-based planners can be configured to optimize for certain path quality criteria.
The optimization objective is defined by the ompl.optimization_objective
setting:
Value | Description |
---|---|
min_pathlength | Minimize path length |
min_smoothness | Minimize smoothness as defined by OMPL: \(\mbox{smoothness} = \sum\limits_{i=2}^{n-1}\left(\frac{2\left(\pi - \arccos\left(\frac{a_i^2+b_i^2-c_i^2}{2 a_i b_i}\right)\right)}{a_i + b_i}\right)^2\) |
min_curvature | Minimize normalized curvature along the path (normalized by the path length) \(\kappa_\mathrm{norm}=\sum_i\int_{\sigma_i}\kappa(\dot{\sigma}_i(t))\parallel\dot{p}_{\sigma_i}(t)\parallel_2\,dt\), where \(\sigma_i\) are the continuous curvature segments (between the cusps) of the full trajectory \(\sigma\) and \(\kappa(\dot{\sigma}(t))\) computes the curvature at a point \(\sigma(t)\) of the trajectory and \(p_\sigma\) denotes the \(x\) and \(y\) components of \(\sigma\) |
max_minclearance | Maximize minimum clearance (distance to nearest obstacle along the entire path) |
Example
def create_mpb(optimization_objective):
mpb = MPB()
mpb["max_planning_time"] = 2
mpb.set_planners(['prm'])
mpb["ompl.sampler"] = "halton"
mpb.set_steer_functions(['reeds_shepp'])
mpb['ompl.cost_threshold'] = 0
mpb.set_corridor_grid_env(radius=5, branches = 15)
mpb["ompl.seed"] = 0
mpb.set_id(optimization_objective)
mpb["ompl.optimization_objective"] = optimization_objective
return mpb
pool = MultipleMPB()
pool.benchmarks.append(create_mpb("min_pathlength"))
pool.benchmarks.append(create_mpb("min_smoothness"))
pool.benchmarks.append(create_mpb("min_curvature"))
pool.benchmarks.append(create_mpb("max_minclearance"))
pool.run_parallel(runs=25, id='optimization_objectives', show_plot=False)
pool.merge('optimization_objectives/optimization_objectives.json',
plan_names=['PRM (min_pathlength)',
'PRM (min_smoothness)',
'PRM (min_curvature)',
'PRM (max_minclearance)'])
from trajectory import visualize
visualize('optimization_objectives/optimization_objectives.json', num_colors=10)
from plot_stats import plot_planner_stats
plot_planner_stats('optimization_objectives/optimization_objectives.json', num_colors=10)