fix: driver LGA60
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
#include "lidar_interface.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -18,6 +19,11 @@ inline constexpr ModelConfig MODEL_ESPE_LGA60 { "ESPE-LGA60", -160.f, 160.f, 0.0
|
||||
// ROS driver; NOT verified on real hardware. open() sends the "RAuto" start
|
||||
// command; device parameters (spin rate, resolution, filters) are whatever
|
||||
// the vendor Windows config tool programmed — this driver does not set them.
|
||||
//
|
||||
// The device streams each 20°→340° sweep as several packets, so a scan is
|
||||
// assembled across packets and only completes when the sweep closes at 340°
|
||||
// (see handle_range_frame). Rotation timing is measured host-side: the wire
|
||||
// carries no usable clock.
|
||||
class EspeDriver : public LidarDriverInterface {
|
||||
public:
|
||||
// ip: device address; use_udp selects the transport the device is
|
||||
@@ -52,6 +58,8 @@ private:
|
||||
bool fill_buffer(int timeout_ms); // one recv() into recv_buf_
|
||||
bool parse_buffer(); // consume frames; true when a scan completed
|
||||
void handle_range_frame(const uint8_t* frame, uint16_t data_size);
|
||||
void set_resolution(float inc_deg); // latch the step + (re)size the revolution
|
||||
void begin_revolution(); // blank the buffer for a fresh sweep
|
||||
void finish_scan();
|
||||
|
||||
ModelConfig cfg_;
|
||||
@@ -66,13 +74,19 @@ private:
|
||||
// Stream bytes carried across frame boundaries; per-instance.
|
||||
std::string recv_buf_;
|
||||
|
||||
// Per-revolution accumulation
|
||||
// Per-revolution accumulation. A revolution is the device's fixed
|
||||
// 20°→340° sweep, so it holds 320°/angle_inc_deg_ points — several
|
||||
// packets' worth. The header's point counters describe one PACKET and say
|
||||
// nothing about the revolution's size.
|
||||
std::vector<float> pending_ranges_;
|
||||
std::vector<float> pending_intensities_;
|
||||
float rev_start_deg_ = 0.f; // device angle of the revolution's first point
|
||||
float angle_inc_deg_ = 0.f;
|
||||
uint32_t points_total_ = 0; // measure_size from the header; 0 = no rev open
|
||||
uint16_t pending_time_ = 0; // header "time" field, unit unverified
|
||||
float angle_inc_deg_ = 0.f; // angular step; 0 = not latched yet
|
||||
uint32_t points_total_ = 0; // points per revolution = 320° / step
|
||||
|
||||
// Rotation period, measured host-side between completed revolutions: the
|
||||
// wire carries no usable clock (see finish_scan()).
|
||||
std::chrono::steady_clock::time_point last_rev_end_{};
|
||||
bool have_last_rev_ = false;
|
||||
|
||||
// Latched from the newest "WSimu" area frame, if the device sends any.
|
||||
std::optional<uint16_t> espe_error_status_;
|
||||
|
||||
Reference in New Issue
Block a user