Struct ros_pointcloud2::ros_types::PointCloud2Msg
source · 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: boolTrait Implementations§
source§impl Clone for PointCloud2Msg
impl Clone for PointCloud2Msg
source§fn clone(&self) -> PointCloud2Msg
fn clone(&self) -> PointCloud2Msg
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for PointCloud2Msg
impl Debug for PointCloud2Msg
source§impl Default for PointCloud2Msg
impl Default for PointCloud2Msg
source§fn default() -> PointCloud2Msg
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>,
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>
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
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>,
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>
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
type Error = ConversionError
The type returned in the event of a conversion error.
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> 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
Mutably borrows from an owned value. Read more