Skip to main content

CuPlanningScene

Struct CuPlanningScene 

Source
pub struct CuPlanningScene<const MAX_OBSTACLES: usize = DEFAULT_MAX_OBSTACLES, const MAX_ATTACHED: usize = DEFAULT_MAX_ATTACHED> { /* private fields */ }
Expand description

Fixed-capacity, versioned planning scene storage (CuMsgPayload-compliant).

Holds environment obstacles in world frame and attached shapes in robot frames. Every mutation is transactional and increments CuSceneRevision on success. collision_env borrows the scene as a zero-copy CuCollisionEnv.

Implementations§

Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source

pub const OBSTACLE_CAPACITY: usize = MAX_OBSTACLES

Maximum number of environment obstacles.

Source

pub const ATTACHED_CAPACITY: usize = MAX_ATTACHED

Maximum number of attached shapes.

Source

pub fn new() -> Self

Creates an empty planning scene initialized at CuSceneRevision::INITIAL.

Source

pub const fn revision(&self) -> CuSceneRevision

Returns the current scene revision.

Source

pub const fn is_empty(&self) -> bool

Returns true if the scene has neither obstacles nor attached shapes.

Source

pub fn obstacle_shapes(&self) -> &[CuCollisionShape]

Active obstacle shapes in world coordinates; the count is obstacle_shapes().len().

Source

pub fn obstacle_ids(&self) -> &[CuObjectId]

Stable IDs of the active obstacles, parallel to obstacle_shapes.

Source

pub fn obstacles(&self) -> impl Iterator<Item = CuSceneObstacle> + '_

Iterates over the active obstacles with their IDs.

Source

pub fn attached_shapes(&self) -> &[CuAttachedShape]

Active attached shapes; the count is attached_shapes().len().

Source

pub fn obstacle(&self, id: CuObjectId) -> Option<&CuCollisionShape>

Looks up an obstacle shape by its typed object ID.

Source

pub fn attached_shape(&self, id: CuObjectId) -> Option<&CuAttachedShape>

Looks up an attached shape by its typed object ID.

Source

pub fn contains(&self, id: CuObjectId) -> bool

Returns true if the specified object identifier is present in the scene.

Source

pub fn collision_env(&self) -> CuCollisionEnv<'_>

Zero-copy view of the obstacles (with IDs) and attached shapes for collision checks. Add exclusions with CuCollisionEnv::with_exclusions.

Source

pub fn add_obstacle( &mut self, shape: CuCollisionShape, id: Option<CuObjectId>, ) -> CuResult<CuObjectId>

Adds a world-frame obstacle and returns its ID.

With id = None a fresh unique ID is assigned; with Some(id) that ID is used and must be valid and unused. Fails on capacity, invalid geometry, invalid or duplicate ID, or revision exhaustion; on failure, state is unmodified.

Source

pub fn update_obstacle( &mut self, id: CuObjectId, shape: CuCollisionShape, ) -> CuResult<()>

Replaces the geometry of an existing obstacle. On failure, state is unmodified.

Source

pub fn remove_obstacle(&mut self, id: CuObjectId) -> CuResult<CuCollisionShape>

Removes an obstacle, preserving the order of the others. On failure, state is unmodified.

Source

pub fn add_attached( &mut self, frame: Option<usize>, shape: CuCollisionShape, id: Option<CuObjectId>, ) -> CuResult<CuObjectId>

Adds a shape attached to frame (None = base frame) and returns its ID.

ID assignment follows add_obstacle. On failure, state is unmodified.

Source

pub fn update_attached( &mut self, id: CuObjectId, update: CuAttachedUpdate, ) -> CuResult<()>

Changes the frame and/or geometry of an attached shape. On failure, state is unmodified.

Source

pub fn remove_attached(&mut self, id: CuObjectId) -> CuResult<CuAttachedShape>

Removes an attached shape, preserving the order of the others. On failure, state is unmodified.

Source

pub fn attach( &mut self, id: CuObjectId, frame: Option<usize>, local_shape: CuCollisionShape, ) -> CuResult<()>

Turns an existing obstacle into a shape attached to frame (e.g. object grasp), keeping its CuObjectId. local_shape is the geometry in frame coordinates.

Fails if the obstacle is not found, geometry is invalid, attached storage is full, or the revision is exhausted. On failure, state is unmodified.

Source

pub fn detach( &mut self, id: CuObjectId, world_shape: CuCollisionShape, ) -> CuResult<()>

Turns an attached shape into a world-frame obstacle (e.g. object release), keeping its CuObjectId.

Fails if the attached shape is not found, geometry is invalid, obstacle storage is full, or the revision is exhausted. On failure, state is unmodified.

Source

pub fn clear(&mut self) -> CuResult<()>

Clears all obstacles and attached shapes, advancing the revision if the scene was not empty. On failure (revision exhaustion), state is unmodified.

Source

pub fn clear_obstacles(&mut self) -> CuResult<()>

Clears all obstacles, advancing the revision if any were present. On failure, state is unmodified.

Source

pub fn clear_attached(&mut self) -> CuResult<()>

Clears all attached shapes, advancing the revision if any were present. On failure, state is unmodified.

Source

pub fn transaction<F, R>(&mut self, f: F) -> CuResult<R>
where F: FnOnce(&mut Self) -> CuResult<R>,

Executes a transaction block on the planning scene.

If the closure f succeeds, modifications are committed and the revision advances once if state was modified without advancing it. If f returns an error or revision exhaustion occurs, the scene rolls back to its pre-transaction state.

Source

pub fn world_attached_shapes<const N: usize, const MAX_OUT: usize>( &self, link_frames: &[Transform3D<f64>; N], out_shapes: &mut [CuCollisionShape; MAX_OUT], ) -> CuResult<usize>

Writes world-space copies of the active attached shapes for link_frames into out_shapes and returns how many were written.

Validates capacity, frame indices, transforms, and resulting geometry first: on error, out_shapes is unmodified.

Trait Implementations§

Source§

impl<'de, C, const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> BorrowDecode<'de, C> for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn borrow_decode<D: BorrowDecoder<'de, Context = C>>( decoder: &mut D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Clone for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn clone(&self) -> CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Debug for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Decode<C> for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn decode<D: Decoder<Context = C>>(decoder: &mut D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Default for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Deserialize<'de> for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Encode for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> PartialEq for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn eq(&self, other: &CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Serialize for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> StructuralPartialEq for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Source§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> TypePath for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

§

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 MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Freeze for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> RefUnwindSafe for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Send for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Sync for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> Unpin for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> UnsafeUnpin for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

§

impl<const MAX_OBSTACLES: usize, const MAX_ATTACHED: usize> UnwindSafe for CuPlanningScene<MAX_OBSTACLES, MAX_ATTACHED>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> CuMsgPayload for T
where T: Default + Debug + Clone + Encode + Decode<()> + Serialize + DeserializeOwned + Reflect,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> GetTypeRegistration for T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PayloadDefaultHandlePolicyApply for T
where T: ?Sized,

§

fn apply_handle_content_policy(&self, _mode: HandleContent)

§

impl<T> PayloadDefaultLoggingPolicy for T
where T: ?Sized,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Reflect for T
where T: 'static,

§

impl<T> ReflectTypePath for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.