pub struct PointCloud2Msg {
    pub header: HeaderMsg,
    pub height: u32,
    pub width: u32,
    pub fields: Vec<PointFieldMsg>,
    pub is_bigendian: bool,
    pub point_step: u32,
    pub row_step: u32,
    pub data: Vec<u8>,
    pub is_dense: bool,
}

Fields§

§header: HeaderMsg§height: u32§width: u32§fields: Vec<PointFieldMsg>§is_bigendian: bool§point_step: u32§row_step: u32§data: Vec<u8>§is_dense: bool

Trait Implementations§

source§

impl Clone for PointCloud2Msg

source§

fn clone(&self) -> PointCloud2Msg

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for PointCloud2Msg

source§

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

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

impl Default for PointCloud2Msg

source§

fn default() -> PointCloud2Msg

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

impl<T, const SIZE: usize, const DIM: usize, const METADIM: usize, C> TryFrom<PointCloud2Msg> for Convert<T, SIZE, DIM, METADIM, C>
where T: FromBytes, C: PointConvertible<T, SIZE, DIM, METADIM>,

source§

fn try_from(cloud: PointCloud2Msg) -> Result<Self, Self::Error>

Converts a ROS PointCloud2 message into a Convert struct that implements the Iterator trait. Iterate over the struct to get or use the points.

§Example

Since we do not have a ROS node here, we first create a PointCloud2 message and then convert back to a Convert struct.

use ros_pointcloud2::ros_types::PointCloud2Msg;
use ros_pointcloud2::ConvertXYZ;
use ros_pointcloud2::pcl_utils::PointXYZ;

let cloud_points: Vec<PointXYZ> = vec![
    PointXYZ { x: 1.0, y: 2.0, z: 3.0 },
    PointXYZ { x: 4.0, y: 5.0, z: 6.0 },
];
let msg: PointCloud2Msg = ConvertXYZ::try_from(cloud_points).unwrap().try_into().unwrap();

let convert: ConvertXYZ = ConvertXYZ::try_from(msg).unwrap(); // parse message
§

type Error = ConversionError

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

impl<T, const SIZE: usize, const DIM: usize, const METADIM: usize, C> TryInto<PointCloud2Msg> for Convert<T, SIZE, DIM, METADIM, C>
where T: FromBytes, C: PointConvertible<T, SIZE, DIM, METADIM>,

source§

fn try_into(self) -> Result<PointCloud2Msg, Self::Error>

Convert the point cloud to a ROS message. First use the try_from method for initializing the conversion and parsing meta data. Then use the try_into method to do the actual conversion.

§Example
use ros_pointcloud2::ros_types::PointCloud2Msg;
use ros_pointcloud2::ConvertXYZ;
use ros_pointcloud2::pcl_utils::PointXYZ;

let cloud_points: Vec<PointXYZ> = vec![
    PointXYZ { x: 1.0, y: 2.0, z: 3.0 },
    PointXYZ { x: 4.0, y: 5.0, z: 6.0 },
];
let msg_out: PointCloud2Msg = ConvertXYZ::try_from(cloud_points).unwrap().try_into().unwrap();
§

type Error = ConversionError

The type returned in the event of a conversion error.

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.