-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ros_pointcloud2" | ||
version = "0.5.2" | ||
version = "0.5.3" | ||
edition = "2021" | ||
authors = ["Christopher Sieh <[email protected]>"] | ||
description = "Customizable conversions for working with sensor_msgs/PointCloud2." | ||
|
@@ -38,6 +38,9 @@ rayon = { version = "1", optional = true } | |
nalgebra = { version = "0.33", optional = true, default-features = false } | ||
rpcl2-derive = { version = "0.4", optional = true, path = "../rpcl2-derive" } | ||
serde = { version = "1.0", features = ["derive"], optional = true } | ||
ros2-interfaces-jazzy = { version = "0.0.4", features = [ | ||
"sensor_msgs", | ||
], optional = true } | ||
|
||
[dev-dependencies] | ||
rand = "0.9" | ||
|
@@ -53,6 +56,7 @@ path = "benches/roundtrip.rs" | |
serde = ["dep:serde", "nalgebra/serde-serialize-no-std"] | ||
rosrust_msg = ["dep:rosrust_msg", "dep:rosrust"] | ||
r2r_msg = ["dep:r2r"] | ||
ros2-interfaces-jazzy = ["dep:ros2-interfaces-jazzy"] | ||
rayon = ["dep:rayon"] | ||
derive = ["dep:rpcl2-derive"] | ||
nalgebra = ["dep:nalgebra"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#[cfg(feature = "ros2-interfaces-jazzy")] | ||
#[test] | ||
fn convertxyz_ros2_interfaces_jazzy_msg() { | ||
use ros_pointcloud2::{points::PointXYZ, PointCloud2Msg}; | ||
|
||
use ros2_interfaces_jazzy::sensor_msgs::msg::PointCloud2; | ||
|
||
let cloud = vec![ | ||
PointXYZ { | ||
x: 1.0, | ||
y: 2.0, | ||
z: 3.0, | ||
}, | ||
PointXYZ { | ||
x: 4.0, | ||
y: 5.0, | ||
z: 6.0, | ||
}, | ||
PointXYZ { | ||
x: 7.0, | ||
y: 8.0, | ||
z: 9.0, | ||
}, | ||
]; | ||
let copy = cloud.clone(); | ||
let internal_cloud = PointCloud2Msg::try_from_iter(cloud).unwrap(); | ||
let ros2_msg_cloud: PointCloud2 = internal_cloud.into(); | ||
let convert_back_internal: PointCloud2Msg = ros2_msg_cloud.into(); | ||
let to_convert = convert_back_internal.try_into_iter().unwrap(); | ||
let back_to_type = to_convert.collect::<Vec<PointXYZ>>(); | ||
assert_eq!(copy, back_to_type); | ||
} |