update Diagnostics
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "lidarlib/diagnostics.hpp"
|
||||
#include "lidarlib/error.hpp"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
@@ -39,6 +40,13 @@ struct ExtraInfo {
|
||||
std::optional<uint16_t> output_status;
|
||||
std::optional<uint32_t> field_status;
|
||||
std::optional<uint32_t> status_flags;
|
||||
|
||||
// SICK TiM only — LMDscandata status pair (word0<<8)|word1:
|
||||
// 0 ok, 1 error, 2 pollution warning, 4 pollution error.
|
||||
std::optional<uint16_t> sick_device_status;
|
||||
|
||||
// SICK nanoScan3 only — General System State byte 0 (see kNanoState* bits).
|
||||
std::optional<uint8_t> nano_general_state;
|
||||
};
|
||||
|
||||
struct ScanResult {
|
||||
@@ -101,6 +109,12 @@ public:
|
||||
// Status of the most recent open()/recv_scan()/spin_once() call.
|
||||
ErrorCode last_error() const { return last_error_; }
|
||||
|
||||
// Device self-diagnostics from the newest fully decoded scan. valid stays
|
||||
// false until one scan has been seen — and permanently on drivers whose
|
||||
// wire format carries no diagnostic fields (SICK, for now). Updated by
|
||||
// recv_scan()/spin_once(); call from the same thread that pumps them.
|
||||
virtual Diagnostics get_diagnostics() const { return {}; }
|
||||
|
||||
protected:
|
||||
ErrorCode set_error(ErrorCode e) { last_error_ = e; return e; }
|
||||
|
||||
@@ -134,6 +148,8 @@ public:
|
||||
// Model name read from the Family B/C header; "AUTO" until one is seen.
|
||||
const char* detected_model() const override { return detected_model_name_.c_str(); }
|
||||
|
||||
Diagnostics get_diagnostics() const override { return latest_diag_; }
|
||||
|
||||
private:
|
||||
bool parse_family_a(const uint8_t* buf, int len); // ID=0xFAF0
|
||||
bool parse_family_b(const uint8_t* buf, int len); // ID=0xFEF0
|
||||
@@ -159,6 +175,9 @@ private:
|
||||
|
||||
ExtraInfo pending_info_;
|
||||
|
||||
// Snapshot for get_diagnostics(); refreshed by flush_scan().
|
||||
Diagnostics latest_diag_;
|
||||
|
||||
ScanResult ready_result_;
|
||||
bool scan_ready_ = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user