pub struct Obstacles { /* private fields */ }Expand description
A set of convex polytope obstacles, checked against reachable sets.
Each check calls SparsePolyZonotope::intersection with a split budget of
Obstacles::max_splits. Splitting refines the enclosure where it is too coarse to
separate a set from an obstacle, so a set is only given up on after the budget is spent.
§Examples
use robust_planning::{Obstacles, SafetyVerdict};
use robust_planning::polyzonotope::{
Interval, IntervalBox, Polytope, SparsePolyZonotope, Zonotope,
};
let square = |lo: f64, hi: f64| IntervalBox(vec![Interval::new(lo, hi); 2]);
let obstacles = Obstacles::new(vec![Polytope::from_box(&square(2.0, 3.0))], 4);
let clear = SparsePolyZonotope::from_zonotope(&Zonotope::from_box(&square(0.0, 1.0)));
let touching = SparsePolyZonotope::from_zonotope(&Zonotope::from_box(&square(1.5, 2.5)));
assert_eq!(obstacles.check_set(&clear), SafetyVerdict::Safe);
assert_eq!(obstacles.check_set(&touching), SafetyVerdict::Indeterminate);Implementations§
Source§impl Obstacles
impl Obstacles
Sourcepub const fn new(polytopes: Vec<Polytope>, max_splits: usize) -> Self
pub const fn new(polytopes: Vec<Polytope>, max_splits: usize) -> Self
Creates an obstacle set with the given split budget per set and obstacle.
Sourcepub const fn max_splits(&self) -> usize
pub const fn max_splits(&self) -> usize
Split budget per set and obstacle.
Sourcepub fn check_set(&self, set: &SparsePolyZonotope) -> SafetyVerdict
pub fn check_set(&self, set: &SparsePolyZonotope) -> SafetyVerdict
Checks one set against every obstacle.
Returns SafetyVerdict::Safe only if the set is proven disjoint from every obstacle.
Stops at the first obstacle that is not proven disjoint and returns its verdict.
§Panics
Panics if an obstacle’s facet normals do not have the set’s dimension.
Sourcepub fn check_sets(&self, sets: &[SparsePolyZonotope]) -> SafetyVerdict
pub fn check_sets(&self, sets: &[SparsePolyZonotope]) -> SafetyVerdict
Checks every set, for example all sets covering one edge.
Returns SafetyVerdict::Safe only if every set is proven disjoint from every
obstacle; an empty list is safe. Stops at the first set that is not proven safe.
§Panics
Panics if an obstacle’s facet normals do not have a set’s dimension.
Trait Implementations§
impl StructuralPartialEq for Obstacles
Auto Trait Implementations§
impl Forget for Obstacles
impl Freeze for Obstacles
impl Move for Obstacles
impl RefUnwindSafe for Obstacles
impl Send for Obstacles
impl Sync for Obstacles
impl Unpin for Obstacles
impl UnsafeUnpin for Obstacles
impl UnwindSafe for Obstacles
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.