Skip to content

Commit f3d135e

Browse files
committed
prepare release
1 parent 6e11289 commit f3d135e

12 files changed

Lines changed: 1091 additions & 777 deletions

File tree

.github/workflows/tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ jobs:
2121
with:
2222
components: clippy
2323
- name: Linting
24-
run: cargo clippy --all-targets --features derive,nalgebra,rayon,serde -- -D warnings
24+
run: cargo clippy --all-targets --features derive,nalgebra,rayon,serde,rkyv -- -D warnings
2525
- name: Build examples with features
26-
run: cargo build --examples --features derive,nalgebra,rayon,serde,ros2-interfaces-jazzy-serde
26+
run: cargo build --examples --features derive,nalgebra,rayon,serde,rkyv,ros2-interfaces-jazzy-serde
27+
- name: Install cargo-msrv
28+
run: cargo install cargo-msrv
29+
- name: Verify MSRV
30+
run: cd ros_pointcloud2 && cargo msrv verify
2731
- name: Test library
2832
run: cargo test --features derive,nalgebra,rayon,serde

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# Changelog
22

3+
## v0.6.0 - v1.0.0
4+
- `try_from_iter` and `try_into_iter` now accepts references to iterators.
5+
- `try_from_vec` is now `try_from_slice` to better reflect that it does not take ownership of the data.
6+
- Adds the `strict-type-check` feature that enforces strict validation of field datatypes during conversion; RGB <-> f32 compatibility is preserved for legacy packed RGB fields. This feature is enabled by default. When `strict-type-check` is enabled, reading a mismatched type returns a `MsgConversionError::TypeMismatch` at runtime to allow on-the-fly type matching for the user.
7+
- The `MsgConversionError` variants are the same now on `std` and `no_std` builds.
8+
- Fixed copying structured pointclouds from vec with same endianness.
9+
- New feature `rkyv` for (de)serialization of PointCloud2Msg using rkyv. This allows zero-copy deserialization in ROS-like systems that use rkyv for message (de)serialization.
10+
- Many internal optimizations for runtime speed and code maintainability. The main benefit is removed need for allocations in the hot path of conversions.
11+
- Bump msrv to 1.87.
12+
313
## v0.5.2 -> v0.6.0
4-
- All derived points now require `Copy`. This allows `try_from_iter` and `try_from_vec` to not require ownership for the parameter.
14+
- All derived points now require `Copy`. This allows `try_from_iter` and `try_from_slice` to not require ownership for the parameter.
515
- Renamed `rpcl2` derive attribute to `ros`. E.g. `#[rpcl2(rename("test"))]` -> `#[ros(rename("test"))]`.
616
- Feature `ros2-interfaces-jazzy` moved to `ros2-interfaces-jazzy-serde` to keep up-to-date with the latest ros2-client.
717
- Dropping rclrs support until their message generation strategy is finished and the integration can be made easier. The current implementation for is bad for long term maintenance. You can keep using `v0.5.2_rclrs` instead.

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,27 @@ Get started with the example below, check out the other use cases in the `exampl
1111

1212
## Quickstart
1313

14+
```toml
15+
[dependencies]
16+
ros_pointcloud2 = { version = "*", features = ["r2r_msg"]} # r2r
17+
# or
18+
ros_pointcloud2 = { version = "*", features = ["rosrust_msg"]} # rosrust ros1
19+
# or
20+
ros_pointcloud2 = { version = "*", features = ["ros2-interfaces-jazzy-serde"]} # ros2-client
21+
```
22+
1423
```rust
1524
use ros_pointcloud2::prelude::*;
1625

1726
// PointXYZ (and many others) are provided by the crate.
1827
let cloud_points = vec![
19-
PointXYZI::new(91.486, -4.1, 42.0001, 0.1),
20-
PointXYZI::new(f32::MAX, f32::MIN, f32::MAX, f32::MIN),
28+
PointXYZI::new(9.6, 42.0, -6.2, 0.1),
29+
PointXYZI::new(46.0, 5.47, 0.5, 0.1),
2130
];
2231

23-
let out_msg = PointCloud2Msg::try_from_vec(&cloud_points).unwrap();
32+
let out_msg = PointCloud2Msg::try_from_slice(&cloud_points).unwrap();
2433

25-
// Convert the ROS crate message type, we will use r2r here.
34+
// Convert to your ROS crate message type.
2635
// let msg: r2r::sensor_msgs::msg::PointCloud2 = out_msg.into();
2736
// Publish ...
2837

@@ -31,10 +40,9 @@ let out_msg = PointCloud2Msg::try_from_vec(&cloud_points).unwrap();
3140
let in_msg = out_msg;
3241

3342
let processed_cloud = in_msg.try_into_iter().unwrap()
34-
.map(|point: PointXYZ| { // Define the info you want to have from the Msg.
35-
// Some logic here ...
36-
37-
point
43+
.map(|point: PointXYZI| { // Define the type you want to map the data to.
44+
// Access the data like a normal struct.
45+
PointXYZI::new(point.x, point.y, point.z, 0.1)
3846
})
3947
.collect::<Vec<_>>();
4048
```
@@ -57,18 +65,11 @@ There are currently 4 integrations for common ROS crates. We tested them on the
5765

5866
You can use `rosrust`, `r2r` or `ros2-client` by enabling the respective feature:
5967

60-
```toml
61-
[dependencies]
62-
ros_pointcloud2 = { version = "*", features = ["r2r_msg"]} # r2r
63-
# or
64-
ros_pointcloud2 = { version = "*", features = ["rosrust_msg"]} # rosrust ros1
65-
# or
66-
ros_pointcloud2 = { version = "*", features = ["ros2-interfaces-jazzy-serde"]} # ros2-client
67-
```
68-
6968
### rclrs (ros2_rust)
7069

71-
Features do not work properly with `rcrls` because the messages are linked externally. You need to use tags instead:
70+
Features do not work properly with `rcrls` because the messages are linked externally. You need to use tags instead.
71+
72+
Mind that this integration is deprecated until rclrs has a better message generation strategy.
7273

7374
```toml
7475
[dependencies]

ros_pointcloud2/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ros_pointcloud2"
3-
version = "0.6.0"
3+
version = "1.0.0-rc1"
44
edition = "2021"
55
authors = ["Christopher Sieh <stelzo@steado.de>"]
66
description = "Customizable conversions for working with sensor_msgs/PointCloud2."
@@ -28,7 +28,7 @@ exclude = [
2828
"**/doc/**",
2929
"**/ensure_no_std/**",
3030
]
31-
rust-version = "1.77"
31+
rust-version = "1.87"
3232

3333
[dependencies]
3434
rosrust_msg = { version = "0.1.8", optional = true }
@@ -39,6 +39,7 @@ rayon = { version = "1", optional = true }
3939
nalgebra = { version = "0.34", optional = true, default-features = false }
4040
rpcl2-derive = { version = "0.5", optional = true, path = "../rpcl2-derive" }
4141
serde = { version = "1.0", features = ["derive"], optional = true }
42+
rkyv = { version = "0.8", optional = true }
4243
ros2-interfaces-jazzy-serde = { version = "0.0.4", features = [
4344
"sensor_msgs",
4445
], optional = true }
@@ -62,13 +63,15 @@ rosrust_msg = ["dep:rosrust_msg", "dep:rosrust"]
6263
r2r_msg = ["dep:r2r"]
6364
# safe_drive_msg = ["dep:safe_drive"]
6465
ros2-interfaces-jazzy-rkyv = ["dep:ros2-interfaces-jazzy-rkyv"]
66+
rkyv = ["dep:rkyv", "std"]
6567
ros2-interfaces-jazzy-serde = ["dep:ros2-interfaces-jazzy-serde"]
6668
rayon = ["dep:rayon"]
6769
derive = ["dep:rpcl2-derive"]
6870
nalgebra = ["dep:nalgebra"]
6971
std = ["nalgebra/std"]
72+
strict-type-check = []
7073

71-
default = ["std"]
74+
default = ["std", "strict-type-check"]
7275

7376
[package.metadata.docs.rs]
7477
features = ["derive", "nalgebra", "rayon", "serde"]

ros_pointcloud2/benches/roundtrip.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn heavy_computing(point: &PointXYZ, iterations: u32) -> f32 {
164164

165165
fn roundtrip_vec(cloud: Vec<PointXYZB>) -> bool {
166166
let orig_len = cloud.len();
167-
let internal_msg = PointCloud2Msg::try_from_vec(&cloud).unwrap();
167+
let internal_msg = PointCloud2Msg::try_from_slice(&cloud).unwrap();
168168
let total: Vec<PointXYZ> = internal_msg.try_into_vec().unwrap();
169169
orig_len == total.len()
170170
}
@@ -181,7 +181,7 @@ fn roundtrip(cloud: Vec<PointXYZB>) -> bool {
181181

182182
fn roundtrip_filter_vec(cloud: Vec<PointXYZB>) -> bool {
183183
let orig_len = cloud.len();
184-
let internal_msg = PointCloud2Msg::try_from_vec(&cloud).unwrap();
184+
let internal_msg = PointCloud2Msg::try_from_slice(&cloud).unwrap();
185185
let total = internal_msg
186186
.try_into_iter()
187187
.unwrap()
@@ -242,7 +242,7 @@ fn roundtrip_computing_par_par(cloud: Vec<PointXYZB>) -> bool {
242242
}
243243

244244
fn roundtrip_computing_vec(cloud: Vec<PointXYZB>) -> bool {
245-
let internal_msg = PointCloud2Msg::try_from_vec(&cloud).unwrap();
245+
let internal_msg = PointCloud2Msg::try_from_slice(&cloud).unwrap();
246246
let total: f32 = internal_msg
247247
.try_into_vec()
248248
.unwrap()

0 commit comments

Comments
 (0)