pub struct PointCloud2Msg {
pub header: HeaderMsg,
pub dimensions: CloudDimensions,
pub fields: Vec<PointFieldMsg>,
pub endian: Endian,
pub point_step: u32,
pub row_step: u32,
pub data: Vec<u8>,
pub dense: Denseness,
}Expand description
The intermediate point cloud type for ROS integrations.
To assert consistency, the type should be build with the PointCloud2MsgBuilder.
See the offical ROS message description for more information on the fields.
Fields§
§header: HeaderMsg§dimensions: CloudDimensions§fields: Vec<PointFieldMsg>§endian: Endian§point_step: u32§row_step: u32§data: Vec<u8>§dense: DensenessImplementations§
Source§impl PointCloud2Msg
impl PointCloud2Msg
Sourcepub fn try_from_iter<'a, const N: usize, C>(
iterable: impl IntoIterator<Item = &'a C>,
) -> Result<PointCloud2Msg, MsgConversionError>where
C: PointConvertible<N> + 'a,
pub fn try_from_iter<'a, const N: usize, C>(
iterable: impl IntoIterator<Item = &'a C>,
) -> Result<PointCloud2Msg, MsgConversionError>where
C: PointConvertible<N> + 'a,
Create a PointCloud2Msg from any iterable type that implements PointConvertible.
§Example
use ros_pointcloud2::prelude::*;
let cloud_points: Vec<PointXYZ> = vec![
PointXYZ::new(1.0, 2.0, 3.0),
PointXYZ::new(4.0, 5.0, 6.0),
];
Sourcepub fn try_from_vec<const N: usize, C>(
vec: &[C],
) -> Result<PointCloud2Msg, MsgConversionError>where
C: PointConvertible<N>,
pub fn try_from_vec<const N: usize, C>(
vec: &[C],
) -> Result<PointCloud2Msg, MsgConversionError>where
C: PointConvertible<N>,
Create a PointCloud2Msg from a Vec of points.
Since the point type is known at compile time, the conversion is done by direct copy.
§Example
use ros_pointcloud2::prelude::*;
let cloud_points: Vec<PointXYZ> = vec![
PointXYZ::new(1.0, 2.0, 3.0),
PointXYZ::new(4.0, 5.0, 6.0),
];
let msg_out = PointCloud2Msg::try_from_vec(&cloud_points).unwrap();§Errors
Returns an error if the byte buffer does not match the expected layout or the message contains other discrepancies.
Sourcepub fn try_into_vec<const N: usize, C>(
self,
) -> Result<Vec<C>, MsgConversionError>where
C: PointConvertible<N>,
pub fn try_into_vec<const N: usize, C>(
self,
) -> Result<Vec<C>, MsgConversionError>where
C: PointConvertible<N>,
Convert the PointCloud2Msg to a Vec of points.
§Example
use ros_pointcloud2::prelude::*;
let cloud_points: Vec<PointXYZI> = vec![
PointXYZI::new(1.0, 2.0, 3.0, 0.5),
PointXYZI::new(4.0, 5.0, 6.0, 1.1),
];
let msg_out = PointCloud2Msg::try_from_vec(&cloud_points).unwrap();
let cloud_points_out: Vec<PointXYZ> = msg_out.try_into_vec().unwrap();
assert_eq!(1.0, cloud_points_out.get(0).unwrap().x);§Errors
Returns an error if the byte buffer does not match the expected layout or the message contains other discrepancies.
Sourcepub fn try_into_iter<const N: usize, C>(
self,
) -> Result<impl Iterator<Item = C>, MsgConversionError>where
C: PointConvertible<N>,
pub fn try_into_iter<const N: usize, C>(
self,
) -> Result<impl Iterator<Item = C>, MsgConversionError>where
C: PointConvertible<N>,
Convert the PointCloud2Msg to an iterator.
§Example
use ros_pointcloud2::prelude::*;
let cloud_points: Vec<PointXYZI> = vec![
PointXYZI::new(1.0, 2.0, 3.0, 0.5),
PointXYZI::new(4.0, 5.0, 6.0, 1.1),
];
let msg_out = PointCloud2Msg::try_from_iter(&cloud_points).unwrap();
let cloud_points_out = msg_out.try_into_iter().unwrap().collect::<Vec<PointXYZ>>();§Errors
Returns an error if the byte buffer does not match the expected layout or the message contains other discrepancies.
Trait Implementations§
Source§impl Clone for PointCloud2Msg
impl Clone for PointCloud2Msg
Source§fn clone(&self) -> PointCloud2Msg
fn clone(&self) -> PointCloud2Msg
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PointCloud2Msg
impl Debug for PointCloud2Msg
Source§impl<'de> Deserialize<'de> for PointCloud2Msg
impl<'de> Deserialize<'de> for PointCloud2Msg
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PointCloud2Msg, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PointCloud2Msg, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<PointCloud2> for PointCloud2Msg
Available on crate feature ros2-interfaces-jazzy-serde only.
impl From<PointCloud2> for PointCloud2Msg
ros2-interfaces-jazzy-serde only.Source§fn from(msg: PointCloud2) -> PointCloud2Msg
fn from(msg: PointCloud2) -> PointCloud2Msg
Source§impl Serialize for PointCloud2Msg
impl Serialize for PointCloud2Msg
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for PointCloud2Msg
impl RefUnwindSafe for PointCloud2Msg
impl Send for PointCloud2Msg
impl Sync for PointCloud2Msg
impl Unpin for PointCloud2Msg
impl UnwindSafe for PointCloud2Msg
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.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.