Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
cloudini
The cloudini point cloud compression library as a Rust crate.
The crate provides Rust bindings of the original C++ library by default using the feature flag use_cpp. It requires CMake and a C++ 20 compiler to be installed.
There is a Rust-only rewrite available by disabling the aforementioned feature (e.g. no-default-features = true). It outperforms the cpp version at various use cases, especially with parallel feature enabled. The output is compatible with the cpp version.
Quickstart
Using the ros_pointcloud2 integration via the standard feature ros:
[]
= "0.3.0"
= "1.0.0-rc.3"
use ;
use PointXYZI;
let resolution = 0.001_f32; // 1 mm
// Simulate a Lidar scan
let points: =
.map
.collect;
let cloud = try_from_vec?;
let raw_size = cloud.data.len;
// Compress — 1 mm lossy + ZSTD
let compressed = cloud.compress?;
// compressed is a CompressedPointCloud2 — ship it over DDS, store to disk, etc.
assert!;
// Decompress
let restored = compressed.decompress?;
// Each float component is within resolution / 2 of the original
let tol = resolution / 2.0 + 1e-6;
let restored_points: = restored.try_into_iter?.collect;
for in points.iter.zip
Raw
You can disable the ros_pointcloud2 convenience wrapper by setting no-default-features = true and use the underlying enoder and decoder.
Encode
use ;
// Describe the point layout.
// point_step = sum of all field sizes = 4+4+4+1 = 13 bytes
let info = EncodingInfo ;
let encoder = new;
let compressed: = encoder.encode?;
// compressed is a self-contained buffer: header + chunk data
Decode
use PointcloudDecoder;
let decoder = new;
let : = decoder.decode?;
// decoded.len() == info.width * info.height * info.point_step
Maintaining Note
We must fix the CMake when updating the cloudini library.
cloudini-cpp/cloudini_lib/CMakeLists.txt
old
if(ament_cmake_FOUND)
add_library(cloudini_lib SHARED
${CLOUDINI_SRC}
${PCL_SRC}
)
new
if(BUILD_SHARED_LIBS)
add_library(cloudini_lib SHARED
${CLOUDINI_SRC}
${PCL_SRC}
)
License
The original Cloudini library is bundled and licensed under the Apache 2 License. See ./cloudini-cpp/LICENSE.
The Rust code follows the typical dual-license model: