pub struct CuRobotCollisionModel<const N: usize, const M: usize = N> { /* private fields */ }Expand description
Fixed-capacity model for N movable frames and up to M collision shapes.
Each shape is a CuLinkShape on a joint frame or the base. Shape indices identify contacts
and collision pairs; several shapes may share a frame.
Implementations§
Source§impl<const N: usize, const M: usize> CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> CuRobotCollisionModel<N, M>
Sourcepub fn new(
shapes: &[CuLinkShape],
params: CuCollisionModelParams,
) -> CuResult<Self>
pub fn new( shapes: &[CuLinkShape], params: CuCollisionModelParams, ) -> CuResult<Self>
Creates a model from up to M link shapes.
Self-collision is checked between every pair of shapes on different frames, except
adjacent joint frames when params.skip_adjacent_links is set. Use
set_pair_enabled for further adjustments.
Fails if more than M shapes are given, a frame index is >= N, a shape has invalid
geometry, or the params are invalid.
Sourcepub const fn shape_count(&self) -> usize
pub const fn shape_count(&self) -> usize
Number of active collision shapes.
Sourcepub fn link_shapes(&self) -> &[CuLinkShape]
pub fn link_shapes(&self) -> &[CuLinkShape]
Borrows the active link shapes.
Sourcepub const fn safety_margin(&self) -> Length64
pub const fn safety_margin(&self) -> Length64
Returns the configured safety margin.
Sourcepub fn set_safety_margin(&mut self, safety_margin: Length64) -> CuResult<()>
pub fn set_safety_margin(&mut self, safety_margin: Length64) -> CuResult<()>
Sets the safety margin required for a pair to be considered collision-free.
Sourcepub fn set_pair_enabled(
&mut self,
link_a: usize,
link_b: usize,
enabled: bool,
) -> CuResult<()>
pub fn set_pair_enabled( &mut self, link_a: usize, link_b: usize, enabled: bool, ) -> CuResult<()>
Enables or disables self-collision checking between two shape indices.
Sourcepub const fn is_pair_enabled(&self, link_a: usize, link_b: usize) -> bool
pub const fn is_pair_enabled(&self, link_a: usize, link_b: usize) -> bool
Returns true if self-collision checking is enabled between link_a and link_b.
Sourcepub fn world_link_shapes(
&self,
link_frames: &[Transform3D<f64>; N],
out_shapes: &mut [CuCollisionShape; M],
)
pub fn world_link_shapes( &self, link_frames: &[Transform3D<f64>; N], out_shapes: &mut [CuCollisionShape; M], )
Transforms the active link shapes into world coordinates in place using link_frames.
Only the first shape_count entries of out_shapes are written.
Sourcepub fn check_frames<const MAX_CONTACTS: usize>(
&self,
link_frames: &[Transform3D<f64>; N],
env: &CuCollisionEnv<'_>,
out_report: &mut CuCollisionReport<MAX_CONTACTS>,
) -> CuResult<()>
pub fn check_frames<const MAX_CONTACTS: usize>( &self, link_frames: &[Transform3D<f64>; N], env: &CuCollisionEnv<'_>, out_report: &mut CuCollisionReport<MAX_CONTACTS>, ) -> CuResult<()>
Evaluates self-collision and env (obstacles, attached shapes, exclusions) for
precomputed link_frames, writing contacts and the minimum signed distance into
out_report (cleared first).
Fails, leaving out_report unmodified, if env is invalid for this model (see
CuCollisionEnv).
Sourcepub fn check_configuration<const MAX_CONTACTS: usize>(
&self,
chain: &CuKinematicChain<N>,
q: &[CuJointPosition; N],
env: &CuCollisionEnv<'_>,
out_report: &mut CuCollisionReport<MAX_CONTACTS>,
) -> CuResult<()>
pub fn check_configuration<const MAX_CONTACTS: usize>( &self, chain: &CuKinematicChain<N>, q: &[CuJointPosition; N], env: &CuCollisionEnv<'_>, out_report: &mut CuCollisionReport<MAX_CONTACTS>, ) -> CuResult<()>
Runs forward kinematics for q and calls check_frames.
Sourcepub fn is_configuration_collision_free(
&self,
chain: &CuKinematicChain<N>,
q: &[CuJointPosition; N],
env: &CuCollisionEnv<'_>,
) -> CuResult<bool>
pub fn is_configuration_collision_free( &self, chain: &CuKinematicChain<N>, q: &[CuJointPosition; N], env: &CuCollisionEnv<'_>, ) -> CuResult<bool>
Early-exit predicate: true if q is within joint limits and no checked pair (self,
environment, attached) violates the safety margin.
Sourcepub fn is_segment_collision_free(
&self,
chain: &CuKinematicChain<N>,
q_start: &[CuJointPosition; N],
q_end: &[CuJointPosition; N],
max_step: impl Into<CuJointResolution>,
env: &CuCollisionEnv<'_>,
) -> CuResult<bool>
pub fn is_segment_collision_free( &self, chain: &CuKinematicChain<N>, q_start: &[CuJointPosition; N], q_end: &[CuJointPosition; N], max_step: impl Into<CuJointResolution>, env: &CuCollisionEnv<'_>, ) -> CuResult<bool>
Checks whether the linearly interpolated joint-space segment from q_start to q_end
is collision-free at the given angular and linear sampling resolution.
This is discrete sampling, not swept-volume continuous collision detection.
Trait Implementations§
Source§impl<'de, C, const N: usize, const M: usize> BorrowDecode<'de, C> for CuRobotCollisionModel<N, M>
impl<'de, C, const N: usize, const M: usize> BorrowDecode<'de, C> for CuRobotCollisionModel<N, M>
Source§fn borrow_decode<D: BorrowDecoder<'de, Context = C>>(
decoder: &mut D,
) -> Result<Self, DecodeError>
fn borrow_decode<D: BorrowDecoder<'de, Context = C>>( decoder: &mut D, ) -> Result<Self, DecodeError>
Source§impl<const N: usize, const M: usize> Clone for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> Clone for CuRobotCollisionModel<N, M>
Source§fn clone(&self) -> CuRobotCollisionModel<N, M>
fn clone(&self) -> CuRobotCollisionModel<N, M>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<const N: usize, const M: usize> Copy for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> StructuralPartialEq for CuRobotCollisionModel<N, M>
Source§impl<const N: usize, const M: usize> TypePath for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> TypePath for CuRobotCollisionModel<N, M>
fn type_path() -> &'static str
fn short_type_path() -> &'static str
fn type_ident() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
fn module_path() -> Option<&'static str>
Auto Trait Implementations§
impl<const N: usize, const M: usize> Freeze for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> RefUnwindSafe for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> Send for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> Sync for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> Unpin for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> UnsafeUnpin for CuRobotCollisionModel<N, M>
impl<const N: usize, const M: usize> UnwindSafe for CuRobotCollisionModel<N, M>
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> GetTypeRegistration for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more