Crates.io | realsense-rust |
lib.rs | realsense-rust |
version | 1.2.3 |
source | src |
created_at | 2020-02-24 09:16:40.161544 |
updated_at | 2024-02-28 16:30:42.409525 |
description | High-level RealSense library in Rust |
homepage | https://gitlab.com/tangram-vision-oss/realsense-rust |
repository | https://gitlab.com/tangram-vision-oss/realsense-rust |
max_upload_size | |
id | 211972 |
size | 384,194 |
The project provides high-level bindings (crate realsense_rust
) to librealsense2 library as well
as low-level FFI (crate realsense_sys
) interface.
Default bindings are for librealsense version: 2.54.2
This project is hosted on both Github and Gitlab. While we're happy to receive pull / merge requests on either platform, we focus most of our work on Gitlab, so please submit an issue there if you've found something we need to improve or have a question regarding how things work.
Make sure the current librealsense version above is installed on your system. Visit the RealSense official repository to download and install this on the host machine.
Once that's done, add this crate to your project's Cargo.toml
.
Check out the examples folder for helpful snippets of code, as well as minimal configurations that fit some of the most popular RealSense devices. For more explanation, see the crate documentation.
Use these by running cargo run --features <name of feature>
Non-Linux users: The current bindings are formatted for Linux. Users on systems other than Linux
must run with the buildtime-bindgen
feature to reformat the bindings. See the README in
realsense-sys for more.
Backwards compatibility: If you're using an older librealsense version, you may enable the
buildtime-bindgen
feature to re-generate the bindings. We make no claims of backwards
compatibility; good luck.
USB Current Draw: Many RealSense devices draw more current than a standard USB cable can provide. For example, standard USB can run 0.9 amps, while the RealSense 435i draws 2 amps. Using a USB cable that doesn't have the right current capability will interfere with the USB connection on the host, and the device will seem to disconnect. A device power cycle doesn't always remedy this, either. In many cases, the host USB hub itself will need a reset. Make sure any USB cables used are able to draw at least 2 amps. Read more on the issue here.
USB Bandwidth: When a device is connected, librealsense will measure the transmission speed of data across its USB connection. USB3 speeds can handle all streams running simultaneously. USB2 speeds cannot; trying to set a streaming configuration that is too much for USB2 will result in a failed streaming config, and will cause the program to fail. Luckily, this information can be looked up and compensated for during runtime. See the device-specific demo examples for ways to achieve this.
Supported but Ignored Stream Options: There are a few Sensor options that are registered as "supported" by the sensor, but are actually just set to their default values on runtime. These options are listed and tested in check_supported_but_ignored_sensor_options device tests. Currently, [Rs2Option::GlobalTimeEnabled] on the L500 is the only setting known to suffer from this. However, the test has been written in a way that makes it easy to test more Options for this same behavior.
The realsense-sys crate provides C bindings generated from librealsense headers. See the realsense-sys README for more information.
There's a lot of thought that went into making this library Rust-safe. Check out the architecture doc for our thoughts on Rust safety, error handling, and more for this API.
First, check out our contributing guidelines. After that, make sure that you read through the documentation in lib.rs as well as any of the modules you might be interested in contributing to! If you find documentation missing, this is considered a bug, so please submit a bug report!
Apache 2.0. See LICENSE file.