ld2450-proto 0.2.0

HLK-LD2450 radar sensor protocol parser and command builder
Documentation
  • Coverage
  • 35.53%
    27 out of 76 items documented0 out of 12 items with examples
  • Size
  • Source code size: 30.71 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.24 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 53s Average build duration of successful builds.
  • all releases: 52s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • duramson/ld2450-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • duramson

ld2450-proto

Zero-allocation protocol parser and command builder for the HLK-LD2450 24 GHz mmWave radar sensor.

Part of the ld2450-rs project.

Features

  • Streaming frame parser (state machine, no heap allocation)
  • Command frame builder for all sensor configuration commands
  • ACK response parser with typed data extraction
  • no_std-compatible (uses libm for math)
  • Optional std feature for feed_slice() convenience method

Usage

use ld2450_proto::{FrameParser, ParseEvent};

let mut parser = FrameParser::new();

// Feed bytes from UART one at a time or in slices
for &byte in uart_data {
    if let Some(ParseEvent::Frame(frame)) = parser.feed(byte) {
        for target in frame.active_targets() {
            println!(
                "x={:.3}m y={:.3}m speed={:.2}m/s dist={:.3}m",
                target.x_m(),
                target.y_m(),
                target.speed_ms(),
                target.dist_m(),
            );
        }
    }
}

Protocol

Each radar data frame is 30 bytes:

Header:  AA FF 03 00   (4 bytes)
Target1: [8 bytes]     x(2) + y(2) + speed(2) + resolution(2)
Target2: [8 bytes]
Target3: [8 bytes]
Footer:  55 CC         (2 bytes)

Up to 3 targets tracked simultaneously at 10 Hz.

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.