Voyant API 0.9.2
Loading...
Searching...
No Matches
sensor_state_display.hpp
Go to the documentation of this file.
1// Copyright (c) 2024-2025 Voyant Photonics, Inc.
2// All rights reserved.
3
4#pragma once
5
6#include <iomanip>
7#include <ostream>
9
10inline std::ostream& operator<<(std::ostream& os, const DspFrameStartToggle& v)
11{
12 switch (v)
13 {
15 return os << "CW";
17 return os << "CCW";
18 default:
19 return os << "DspFrameStartToggle(" << static_cast<int>(v) << ")";
20 }
21}
22
23inline std::ostream& operator<<(std::ostream& os, const SdlRampLength& v)
24{
25 switch (v)
26 {
28 return os << "Unknown";
30 return os << "V8_192us";
32 return os << "V16_384us";
33 default:
34 return os << "SdlRampLength(" << static_cast<int>(v) << ")";
35 }
36}
37
38inline std::ostream& operator<<(std::ostream& os, const SdlState& v)
39{
40 switch (v)
41 {
43 return os << "Unknown";
45 return os << "ErrorFault";
46 case SdlState::Boot:
47 return os << "Boot";
49 return os << "Initialization";
51 return os << "Standby";
53 return os << "WarmUp";
54 case SdlState::Idle:
55 return os << "Idle";
57 return os << "PointCloud";
59 return os << "CoolDown";
61 return os << "DebugCalibration";
63 return os << "Reserved";
65 return os << "Reserved11";
67 return os << "Reserved12";
69 return os << "Reserved13";
71 return os << "Reserved14";
73 return os << "FirmwareUpdate";
74 default:
75 return os << "SdlState(" << static_cast<int>(v) << ")";
76 }
77}
78
79inline std::ostream& operator<<(std::ostream& os, const SdlStatus& v)
80{
81 switch (v)
82 {
84 return os << "Unknown";
85 case SdlStatus::Idle:
86 return os << "Idle";
88 return os << "Pending";
90 return os << "Applied";
92 return os << "BadFovCenterCombo";
94 return os << "InvalidParameter";
96 return os << "InvalidStateTransition";
98 return os << "MissingCalibration";
100 return os << "UnableToCalibrate";
102 return os << "ParseError";
104 return os << "ApplicationError";
106 return os << "FovFpsError";
108 return os << "CommandBuildFailed";
110 return os << "PreviousCommandPending";
112 return os << "SendFailed";
114 return os << "Timeout";
116 return os << "MaxRetriesExceeded";
118 return os << "StreamReset";
120 return os << "MessageReadyForMcu";
122 return os << "ValidMessageParsed";
123 default:
124 return os << "SdlStatus(" << static_cast<int>(v) << ")";
125 }
126}
127
128inline std::ostream& operator<<(std::ostream& os, const ProductId& v)
129{
130 switch (v)
131 {
133 return os << "Unknown";
134 case ProductId::Lark:
135 return os << "Lark";
137 return os << "Meadowlark";
139 return os << "Carbon Benchtop";
141 return os << "Carbon 30";
143 return os << "Vivado Simulator";
145 return os << "Verilator Simulator";
147 return os << "Xcelium Simulator";
149 return os << "Isaac Sim";
151 return os << "Software Simulator";
152 default:
153 return os << "ProductId(" << static_cast<int>(v) << ")";
154 }
155}
156
157inline std::ostream& operator<<(std::ostream& os, const SdlDeviceState& s)
158{
159 return os << "SdlDeviceState{"
160 << " state=" << s.device_state << " status=" << s.sdl_status << " fps=" << s.frame_rate_fps
161 << " hfov=" << s.hfov_deg << "deg"
162 << " hfov_center=" << s.hfov_center_deg << "deg"
163 << " bw=" << s.ramp_bandwidth_ghz << "GHz"
164 << " ramp_length=" << s.ramp_length << " }";
165}
166
167inline std::ostream& operator<<(std::ostream& os, const HealthState& h)
168{
169 std::ios_base::fmtflags flags(os.flags());
170 os << std::fixed << std::setprecision(1) << "HealthState{"
171 << " fpga=" << h.fpga_temp_c << "C"
172 << " clarity=" << h.clarity_board_temp_c << "C"
173 << " carat=" << h.carat_board_temp_c << "C"
174 << " pic=" << h.pic_temp_c << "C"
175 << " soa=" << h.soa_temp_c << "C"
176 << " adc=" << h.adc_temp_c << "C" << std::hex << " error=" << h.error_word << " hw_health=" << h.hardware_health
177 << " pwr=" << static_cast<int>(h.power_health) << std::dec << " lo_pwr=" << h.lo_power_mon << " }";
178 os.flags(flags);
179 return os;
180}
181
182inline std::ostream& operator<<(std::ostream& os, const CounterState& c)
183{
184 return os << "CounterState{"
185 << " frames=" << c.total_frame_count << " ramps=" << c.total_ramp_count
186 << " drops=" << c.total_drops_count << " any_drops=" << (c.any_drops_sticky != 0 ? "true" : "false")
187 << " mcu_cycles=" << c.mcu_cycles_counter << " }";
188}
189
190inline std::ostream& operator<<(std::ostream& os, const DeviceInfo& d)
191{
192 return os << "DeviceInfo{"
193 << " serial=" << d.serial_number << " product=" << d.product_id << " fpga=v"
194 << static_cast<int>(d.fpga_version_major) << "." << static_cast<int>(d.fpga_version_minor) << "."
195 << static_cast<int>(d.fpga_version_patch) << " mcu=v" << static_cast<int>(d.mcu_version_major) << "."
196 << static_cast<int>(d.mcu_version_minor) << "." << static_cast<int>(d.mcu_version_patch) << " }";
197}
198
199inline std::ostream& operator<<(std::ostream& os, const CalibrationState& c)
200{
201 std::ios_base::fmtflags flags(os.flags());
202 os << std::fixed << "CalibrationState{"
203 << " encoder_az_offset=" << c.encoder_azimuth_offset << std::setprecision(6)
204 << " doppler_bias=" << c.doppler_calibration_mirror_bias << "m/s"
205 << " doppler_offset=" << c.doppler_calibration_mirror_offset << "m" << std::setprecision(0)
206 << " chirp_bw=" << c.chirp_bandwidth_hz << "Hz" << std::setprecision(4) << " datum=(" << c.datum_delta_x_m << ","
207 << c.datum_delta_y_m << "," << c.datum_delta_z_m << ")m"
208 << " }";
209 os.flags(flags);
210 return os;
211}
212
213inline std::ostream& operator<<(std::ostream& os, const DspHeaderState& d)
214{
215 std::ios_base::fmtflags flags(os.flags());
216 os << "DspHeaderState{"
217 << " ts=" << d.timestamp_seconds << "." << std::setw(9) << std::setfill('0') << d.timestamp_nanoseconds
218 << std::setfill(' ') << " toggle=" << d.frame_start_toggle << " }";
219 os.flags(flags);
220 return os;
221}
222
223inline std::ostream& operator<<(std::ostream& os, const SensorState& s)
224{
225 return os << "SensorState{\n"
226 << " " << s.device << "\n"
227 << " " << s.sdl << "\n"
228 << " " << s.health << "\n"
229 << " " << s.counters << "\n"
230 << " " << s.calibration << "\n"
231 << " " << s.dsp_header << "\n"
232 << " peaks_per_frame=" << s.peaks_per_frame << " last_heartbeat_frame=" << s.last_heartbeat_frame << "\n}";
233}
DspFrameStartToggle
Enum for dsp::frame_start_toggle register.
Definition sdl_types_generated.hpp:9
SdlRampLength
Enum for sdl::set_ramp_length register.
Definition sdl_types_generated.hpp:14
SdlState
Enum for sdl::set_state register.
Definition sdl_types_generated.hpp:20
@ DebugCalibration
@ FirmwareUpdate
@ Initialization
std::ostream & operator<<(std::ostream &os, const DspFrameStartToggle &v)
Definition sensor_state_display.hpp:10
Definition voyant_types_ffi.hpp:225
float datum_delta_y_m
Definition voyant_types_ffi.hpp:240
float doppler_calibration_mirror_offset
Definition voyant_types_ffi.hpp:237
int16_t encoder_azimuth_offset
Definition voyant_types_ffi.hpp:229
float datum_delta_x_m
Definition voyant_types_ffi.hpp:239
float datum_delta_z_m
Definition voyant_types_ffi.hpp:241
float chirp_bandwidth_hz
Definition voyant_types_ffi.hpp:238
float doppler_calibration_mirror_bias
Definition voyant_types_ffi.hpp:233
Definition voyant_types_ffi.hpp:192
uint64_t total_ramp_count
Definition voyant_types_ffi.hpp:194
uint32_t total_drops_count
Definition voyant_types_ffi.hpp:195
uint8_t any_drops_sticky
Definition voyant_types_ffi.hpp:200
uint64_t total_frame_count
Definition voyant_types_ffi.hpp:193
uint32_t mcu_cycles_counter
Definition voyant_types_ffi.hpp:201
Definition voyant_types_ffi.hpp:211
ProductId product_id
Definition voyant_types_ffi.hpp:213
uint8_t mcu_version_patch
Definition voyant_types_ffi.hpp:219
uint8_t fpga_version_minor
Definition voyant_types_ffi.hpp:215
uint8_t fpga_version_patch
Definition voyant_types_ffi.hpp:216
uint8_t mcu_version_major
Definition voyant_types_ffi.hpp:217
uint8_t mcu_version_minor
Definition voyant_types_ffi.hpp:218
uint32_t serial_number
Definition voyant_types_ffi.hpp:212
uint8_t fpga_version_major
Definition voyant_types_ffi.hpp:214
Definition voyant_types_ffi.hpp:269
int32_t timestamp_nanoseconds
Definition voyant_types_ffi.hpp:274
DspFrameStartToggle frame_start_toggle
Definition voyant_types_ffi.hpp:275
int64_t timestamp_seconds
Definition voyant_types_ffi.hpp:270
Definition voyant_types_ffi.hpp:156
float soa_temp_c
Definition voyant_types_ffi.hpp:172
float fpga_temp_c
Definition voyant_types_ffi.hpp:174
float carat_board_temp_c
Definition voyant_types_ffi.hpp:170
float pic_temp_c
Definition voyant_types_ffi.hpp:171
uint16_t lo_power_mon
Definition voyant_types_ffi.hpp:186
uint8_t power_health
Definition voyant_types_ffi.hpp:168
float adc_temp_c
Definition voyant_types_ffi.hpp:173
uint32_t hardware_health
Definition voyant_types_ffi.hpp:164
uint64_t error_word
Definition voyant_types_ffi.hpp:160
float clarity_board_temp_c
Definition voyant_types_ffi.hpp:169
Definition voyant_types_ffi.hpp:143
float ramp_bandwidth_ghz
Definition voyant_types_ffi.hpp:149
float hfov_center_deg
Definition voyant_types_ffi.hpp:148
float frame_rate_fps
Definition voyant_types_ffi.hpp:146
SdlStatus sdl_status
Definition voyant_types_ffi.hpp:145
SdlState device_state
Definition voyant_types_ffi.hpp:144
float hfov_deg
Definition voyant_types_ffi.hpp:147
SdlRampLength ramp_length
Definition voyant_types_ffi.hpp:150
Definition voyant_types_ffi.hpp:292
HealthState health
Definition voyant_types_ffi.hpp:294
uint64_t last_heartbeat_frame
Definition voyant_types_ffi.hpp:300
CalibrationState calibration
Definition voyant_types_ffi.hpp:297
DeviceInfo device
Definition voyant_types_ffi.hpp:296
CounterState counters
Definition voyant_types_ffi.hpp:295
SdlDeviceState sdl
Definition voyant_types_ffi.hpp:293
DspHeaderState dsp_header
Definition voyant_types_ffi.hpp:298
uint32_t peaks_per_frame
Definition voyant_types_ffi.hpp:299
ProductId
Definition voyant_types_ffi.hpp:26
@ XceliumSimulator
@ VerilatorSimulator
@ SoftwareSimulator
SdlStatus
Definition voyant_types_ffi.hpp:50
@ InvalidStateTransition
@ InvalidParameter
@ MessageReadyForMcu
@ ValidMessageParsed
@ BadFovCenterCombo
@ PreviousCommandPending
@ CommandBuildFailed
@ UnableToCalibrate
@ MissingCalibration
@ MaxRetriesExceeded
@ ApplicationError