LiDAR simulator¶
tools/livox_mid360_sim.py is a stdlib-only Python program that behaves like a Mid-360 on the
wire: it answers control commands, walks the work-state machine and streams point-cloud, IMU
and push packets. Design decisions are recorded in
issue #3.
It exists so that the session layer (#4, #5, #7, #8) and the receive pipeline (#6) can be developed and tested without hardware. It is not a reference for LiDAR behaviour: wherever the wiki is silent the simulator makes an assumption, listed at the end of this page, and each one is due for verification on real hardware (#11).
Running¶
python3 tools/livox_mid360_sim.py # 0.0.0.0, ports 56000/56100/56200/56300/56400
python3 tools/livox_mid360_sim.py --bind 127.0.0.1 --base-port 0 # loopback, free ports
python3 tools/livox_mid360_sim.py --verbose --drop-rate 0.01
python3 tools/livox_mid360_sim.py --pcap capture.pcap --pcap-rate 0.5 # replay a capture at half speed
| Option | Default | Meaning |
|---|---|---|
--bind |
0.0.0.0 |
address to bind; also reported as lidar_ip in the discovery ACK. Bound to 0.0.0.0, the ACK carries the local address on the route to the requester, so a host off loopback can connect (#203); key 0x0004 then reports 127.0.0.1 |
--base-port |
56000 | discovery port; cmd, push, pcl, imu, log follow at +100, +200, +300, +400, +500. 0 picks free ports |
--discovery-ack-broadcast |
off | send the 0x0000 ACK to 255.255.255.255 at the sender's port, as a Mid-360 does (#217); off, it goes to the sender |
--sn |
SIM0000000000001 |
serial number (≤ 16 chars) |
--dev-type |
9 |
dev_type in the discovery ACK, 0..255 (9 is a Mid-360, #58) |
--product-info |
MID360-SIM |
key 0x8001 (≤ 64 chars) |
--version-app / --version-loader / --version-hardware |
0.0.0.1 |
keys 0x8002–0x8004 as a.b.c.d |
--seed |
1 | seed for deterministic point / IMU data and packet drops |
--scene |
random |
point cloud content: seeded random points, or ring, a fixed scene of known points (#132) |
--apply-attitude |
move Cartesian points by the install attitude in key 0x0012 before sending them (#135); off by default, because firmware 13.18.0244 does not do this (#11) |
|
--pcap |
replay the point cloud, IMU, push and firmware log datagrams of a classic pcap instead of generating them (#134, see Behaviour) | |
--pcap-rate |
1.0 | --pcap speed: 2 replays twice as fast as recorded, 0 as fast as possible |
--startup-delay |
0.3 s | time spent in MOTORSTARTUP (after power-on / reboot and whenever the motor starts from IDLE) |
--selfcheck-delay |
0.1 s | time spent in SELFCHECK after power-on / reboot |
--reboot-delay |
0.3 s | the LiDAR keeps running for this long after the 0x0200 / 0x0201 ACK before it powers down (a Mid-360 takes about 1.25 s, #236) |
--reboot-silence |
0.5 s | commands are ignored and nothing is sent for this long after the power-down that follows 0x0200 / 0x0201 |
--frame-ms |
0 | frame_cnt increments at this period; 0 keeps it at 0, as a Mid-360 does (#246) |
--pcl-crc |
fill crc32 in point-cloud packets; a Mid-360 leaves it 0 (#246), IMU packets always carry it |
|
--rate-multiplier |
1.0 | scales the 2083 pkt/s point-cloud rate (with time_interval) and the IMU rate (200 pkt/s unless 0x002B selects another) |
--push-rate |
1.0 | 0x0102 push rate in Hz, not affected by --rate-multiplier |
--drop-rate |
0 | fraction of point-cloud packets silently dropped (udp_cnt still advances) |
--type-switch-gap |
1 | udp_cnt values skipped at a pcl_data_type switch: a Mid-360 skips one without losing a packet (#271); 0 keeps the counter contiguous |
--imu-cfg-unsupported |
emulate firmware without key 0x002B: its write, read and any inquire naming it answer 0x20 |
|
--unsupported-keys |
none | comma-separated writable keys the firmware lacks, handled like 0x002B under --imu-cfg-unsupported; mid360 names the set of a Mid-360 on 13.18.0244: 0x0021, 0x0026, 0x0029, 0x002B (#242; only the 0x002B write was seen rejected) |
--log-chunk-interval |
0.05 s | period of firmware log chunks (0x0300) per enabled log type (#44) |
--log-chunk-bytes |
512 | data bytes per log chunk |
--log-ack-first |
9 | ask for a host ACK on chunks 0..N-1 of a file, as a Mid-360 does (#244) |
--log-ack-every |
0 | also ask on every Nth chunk and on the log_new_file end chunk; 0 never |
--log-ignore-hostcfg |
send log chunks to the sender of 0x0301 instead of the host in key 0x0009 | |
--debug-data-port |
60301 | source port of the debug raw data stream (#93); 0 or --base-port 0 picks a free port |
--debug-data-interval |
0.01 s | period of the debug raw data datagrams while 0x0303 has enabled them |
--debug-data-bytes |
1114 | size of a debug raw data datagram (as measured on a Mid-360) |
--no-quit-on-eof |
keep running when stdin closes (default: quit) | |
--verbose |
log to stderr |
The five sockets are bound at start-up, the same way the real device listens on fixed ports.
Since the real Mid-360 answers discovery on 56000 and commands on 56100, a host using the
default ports talks to the simulator without any change; a test that wants isolation passes
--base-port 0 and reads the actual ports from the ready event.
Control and events¶
The process is driven over its standard streams so that any test harness can use it:
- stdin: one JSON object per line,
{"cmd": ...}. EOF quits unless--no-quit-on-eof. - stdout: one JSON object per line,
{"event": ...}. The first line is alwaysready. - stderr: human-readable log with
--verbose.
| Control | Fields | Effect |
|---|---|---|
quit |
exit with status 0 after emitting exit |
|
silence |
seconds |
simulates a link drop: for seconds commands are ignored and nothing is sent, but the LiDAR keeps running, so udp_cnt, frame_cnt, the push seq and the log trans_index advance and the host sees a gap afterwards (no catch-up burst). A later silence or a reboot only extends it |
hms |
codes (≤ 8 ints) |
set the HMS code slots reported by 0x800E/0x8011 and the push |
drop_ack |
count |
do not answer the next count requests (the request is still processed) |
fail_cmd |
cmd_id, ret (default 1), count (default 1), skip (default 0), key (optional) |
after letting skip of them pass, answer the next count requests with this cmd_id with ret without applying them; with key only 0x0100 / 0x0101 requests that name the key match (it is reported as error_key of 0x0100). One rule per cmd_id |
inquire_override |
key, and one of value (hex string, may be empty), omit, unsupported, clear (each true) |
what 0x0101 answers for key from now on: these bytes instead of the stored value, the key left out of the ACK, the whole inquire rejected with 0x20 naming the key, or the normal answer again. The push and 0x0100 are not affected |
reboot |
same as receiving 0x0200: --reboot-delay, ERROR push, reboot silence, counters reset; if the stored key 0x0004 address differs from the bound one, every socket is rebound to it keeping the ports and a rebound event is emitted (a failed bind emits error and keeps the old sockets) |
|
set_status |
any of diag (u16 bitfield), core_temp (0.01 °C), powerup_cnt, bad_time_offset (1: 0x800B answered truncated to 4 bytes), omit_keys (list of key ids left out of the push); a value that is not an integer applies nothing |
overwrite the read-only status keys the push and 0x0101 report (#56 / #55); the time keys 0x8009–0x800C follow the clock, see time_sync |
time_sync |
any of type (none, ptp or gps), offset_ns (default 0), drift_ppm |
ptp / gps: acquire synchronisation to a master at the host's wall clock plus offset_ns, stepping the clock to it; none: lose it, free running on from the current time; drift_ppm: the free-running rate from now on, without a step (#133). Emits time_sync |
set_state |
state |
force cur_work_state (e.g. 4 ERROR); work_tgt_mode is untouched, so forcing a work substate makes the machine chase the target again |
drop_rate |
rate |
change the point-cloud drop fraction at run time |
drop |
stream (pcl default, or imu), count (default 1) |
do not send the next count packets of the stream; udp_cnt still advances, so the host sees a gap (#131) |
reorder |
stream, count (default 1), depth (default 1, ≥ 1) |
hold the next packet back and send it after depth more packets, count times one after the other (a late packet: udp_cnt goes backwards on the host) |
duplicate |
stream, count (default 1) |
send each of the next count packets twice |
scene |
name (random or ring) |
switch the point cloud content at run time; the ring restarts at point 0 |
frame_ms |
ms |
change the frame_cnt period at run time (0 freezes it); the current frame restarts now |
log_drop |
n |
skip the next n log chunks (trans_index still advances → gap on the host) |
log_new_file |
end the current firmware log file(s) and start the next file_index |
|
status |
emit a status event |
| Event | Fields | When |
|---|---|---|
ready |
ip, ports{discovery,cmd,push,pcl,imu,log}, sn, pid |
sockets bound, main loop starting |
state |
from, to |
work state changed (values as in WorkState) |
cmd |
cmd_id, seq, ret, from |
a request was handled |
ack_dropped |
cmd_id, seq |
a request was handled but the ACK withheld (drop_ack) |
bad_frame |
from, error |
a datagram failed to parse |
sent |
pcl, imu, push, pcl_dropped (--drop-rate and drop), pcl_reordered, pcl_duplicated, imu_dropped, imu_reordered, imu_duplicated, log, debug, silenced (datagrams withheld by a silence), state |
once per second, also while silent |
packet_fault |
stream, fault (drop, reorder, duplicate), udp_cnt |
one packet was affected by a drop / reorder / duplicate control (for reorder: when the held packet is sent) |
log_dropped |
file_index, trans |
a log chunk was withheld (log_drop) |
log_ack |
ret, log_type, file_index, trans |
the host acknowledged a log chunk |
debug_data |
enabled, dest, port (both only when enabled) |
0x0303 switched the debug raw data stream; port is its source port |
control |
cmd |
a control command was applied |
status |
state, sent, hosts{pcl,imu,push,log}, log_enabled, log_acks_received, debug_data{enabled,dest,port}, replay{state,sent,skipped} (null without --pcap), time (as in time_sync) |
answer to status |
time_sync |
type, time_ns (the LiDAR clock now), last_sync_ns (0x800A), offset_ns (0x800B), drift_ppm |
the time_sync control was applied |
replay_start |
file, rate |
the --pcap replay began |
replay_done |
sent{push,pcl,imu,log}, skipped (datagrams of a stream without a host), seconds |
the --pcap replay sent the capture's last datagram |
rebound |
ip, ports |
a reboot moved every socket to the key 0x0004 address |
error |
error |
malformed or unknown control line, or one with a missing or invalid field (nothing of it is applied, the simulator keeps running) |
exit |
sent |
leaving the main loop |
Behaviour¶
- Firmware log (#44): a sixth socket at
+500answers0x0301(payload{log_type, enable}) and streams0x0300chunks of--log-chunk-bytessynthetic text every--log-chunk-intervalfor each enabled type. An undefinedlog_typeis answered with0x00and streams nothing (#276). As on a Mid-360 on 13.18.0244 (#244), a file begins attrans_index0 with the begin flag, byte 2 (file_num) is 0 in that chunk and 1 afterwards,timestampis 0, the first--log-ack-firstchunks ask for an ACK, and disabling a type stops it without an end chunk. Onlylog_new_filesends an empty end-flagged chunk ([unverified] how a file ends on the device). Host ACKs (REQ0x0300with{ret, type, file_index, trans_index}) are counted instatus.log_acks_received. - Debug raw data (#93):
0x0303(payload{enable, host_ip, host_port, reserved}) is answered on the log socket only, as on a Mid-360. While enabled and sampling, a datagram of--debug-data-bytesgoes tohost_ip:host_portevery--debug-data-interval: au32sequence number (little-endian, from 0) followed by bytes counting up from its low byte, so that a receiver can detect loss and corruption. The source socket is bound by the first enable, not at start-up, because 60301 lies inside the Linux ephemeral port range; it is not part ofready.ports. The point cloud keeps flowing. -
Packet faults (#131):
drop,reorderandduplicateact on a point-cloud or IMU packet after itsudp_cntandframe_cntare assigned, so the host sees what a network would do to real packets.--drop-rateis applied first, then per packet a pendingdrop, then areorder(one packet held at a time), then the send (twice for aduplicate). A packet still held back at a reboot is lost. -
Commands
0x0000discovery (unicast or broadcast; the ACK carries the--dev-typevalue, the bound address and the real command port),0x0100configure,0x0101inquire,0x0200reboot,0x0201factory reset,0x0202GPS time. Anything else gets no ACK, as on a Mid-360 (#276). - Configure validates every key first with the wiki return codes (
RetCodeinprotocol.hpp): read-only or unknown →0x20(a Mid-360 does not use the wiki's0x22, #276), wrong length →0x23,pcl_data_typeoutside 1–3 →0x03,pattern_modeabove 2 →0x03, alidar_ipcfgthatlidar_ip_config_valid()rejects →0x03(both measured, #269), a FOV window (0x0015/0x0016) with yaw outside [0, 360], pitch outside [-10, 60] or start > stop →0x03(measured),detect_mode/time_filterabove 1 →0x03(imu_data_enis stored as written, 2 included, as on a Mid-360), animu_sensor_cfgbyte past its last enumerator (rate3, accel > 3, gyro > 7) →
0x03. All keys are applied only if none failed; the ACK'serror_keynames the offender. An inquire0x0101naming an unknown key answers0x20with the known keys and leaves the unknown ones out, as a Mid-360 does (#228). A changedlidar_ipcfgis stored and answered with0x21(reboot required; [unverified] on hardware, where no other key answers0x21(#11) and a changed0x0004needs a reboot to check, #12); writing the current value back is a plain0x00. Value lengths mirrorkey_value_length()inkeys.cpp. The factory FOV windows are yaw 0..0, pitch -7..52 withfov_cfg_en0, andFW_TYPE(0x8010) is 1 (app), as a Mid-360 on 13.18.0244 answers (#242). - State machine the figure in protocol_notes.md:
power-on → SELFCHECK (
--selfcheck-delay, commands are answered) → IDLE, then the machine chaseswork_tgt_mode(SAMPLING by default): IDLE → MOTORSTARTUP (--startup-delay) → READY → SAMPLING. The pass-through READY has no dwell (SAMPLING → IDLE is immediate), but every transition emits astateevent.work_tgt_modeaccepts 1 / 2 / 9 only (any other value →0x03as on a Mid-360, in ERROR / UPGRADE →0x02); a write during SELFCHECK / MOTORSTARTUP is stored and followed afterwards. ERROR / UPGRADE are entered only byset_stateand left byset_stateor a reboot. Reboot and factory reset keep the LiDAR running for--reboot-delayafter the ACK, then send one push reporting ERROR, power down (resetudp_cnt/frame_cnt/seq, stop the debug raw data stream) and stay silent for--reboot-silence; SELFCHECK spans the silence, so the first push after it reports MOTORSTARTUP as on a Mid-360, and the push and log chunks resume after the silence. A second 0x0200 / 0x0201 during the delay does not postpone the power-down; a factory reset among them wins. Reboot keeps every setting,work_tgt_modeincluded, but zeroes thesrc_portof0x0005–0x0007as a Mid-360 does (the simulator keeps sending from its own ports); factory reset restoresfactory_settings()except key0x0004, which goes back to the address the simulator started on (it cannot move to the real factory address 192.168.1.100; after a rebind it moves back). All durations and the return codes are assumptions (#11). - Streaming while SAMPLING: point-cloud packets of 96 points in the configured
pcl_data_typeevery 480 µs (about 2083 pkt/s,time_interval4750,crc320, as a Mid-360 sends them, #246) to the host in key0x0006, IMU packets at the0x002Brate (200 pkt/s by default) to the host in0x0007whenimu_data_en = 1, and a0x0102push once per second to the host in0x0005, plus one at once on every work-state change and after every0x0100request whatever its result, off the periodic phase (not during a--pcapreplay, #235). Nothing is sent to a host whose IP is 0.0.0.0. Packet timestamps andtime_typecome from the LiDAR clock (below). The scheduler bounds catch-up bursts to 256 packets or 20 ms, whichever ends first, so commands are answered and the push is sent while it catches up (#183). It resynchronises if it falls more than 0.5 s behind. IMU packets carrytime_interval0. With--frame-ms,frame_cntfollows the packets' scheduled times, so a burst still changes it once per--frame-ms, and a resync changes it once (#155). - Time (#133): the LiDAR clock stamps every data packet and answers keys
0x8009–0x800C. Unsynchronised (time_type0) it counts from power-on and restarts at 0 with every reboot, at the host's monotonic rate times1 + drift_ppm / 1e6.0x0202(GPS, taking the request's arrival as the PPS edge) or atime_synccontrol withptp/gpssynchronises it: from then on it reads the master time, the host's wall clock plus the master's offset (for0x0202, the GPS time minus the host time at arrival), and data packets carrytime_type1 or 2. Each synchronisation is a step:0x800Abecomes the master time stepped to and0x800Bthe clock's time just before minus that time (local − source). The drift only applies while free running. Losing the sync (time_syncnone) is not a step: the clock runs on free from the time it had, and0x800A/0x800Bkeep the last sync. A reboot loses the sync and keeps the drift. With a steadyptpmaster the real LiDAR would refresh0x800A/0x800Bat every sync message; the simulator only at the step. - Data with
--scene randomis pseudo-random but deterministic for a seed; the C++ decoder only needs valid framing, CRCs and counters. - Ring scene (#132): with
--scene ring(or thescenecontrol) every point is one of 256 known points, so a test can check decoded values, not only framing. Pointk(0–255) has azimuthk * 36000 // 256in 0.01° (sok = 0, 64, 128, 192lie on the axes), elevation(0, 15, -5, 45)[k % 4]°, depth1000 + 30 * kmm, reflectivitykand tagk % 3 | (k // 3 % 3) << 2 | (k // 9 % 3) << 4(every glue / particle / other value, reserved bits 0). Packets carry consecutive points, wrapping after 255, and the cursor goes back to 0 wheneverframe_cntchanges, at a reboot and at ascenecontrol: the first packet of a frame starts at point 0 and every packet at a multiple of 32. Spherical packets carry the exact values (theta= 90° − elevation); Cartesian32 / Cartesian16 ones the same point rounded to mm / cm.tools/test_sim.py(ring_point) andtests/test_scene.cpprestate the definition. - Install attitude (#135): key
0x0012is stored and read back, and by default it does not touch the points, as on a Mid-360 on 13.18.0244 (#11). With--apply-attitudeevery Cartesian32 / Cartesian16 point is moved byRz(yaw) * Ry(pitch) * Rx(roll), then by the translation (the convention ofextrinsic_from()), before it is rounded to mm / cm; values past the field range are clamped. The key's current value is used, so a write takes effect with the next packet. Spherical points are sent unchanged. The FOV crops in the sensor frame, before the attitude. A host that also appliesextrinsic_from()then transforms the cloud twice (see api.md). - Pcap replay (#134): with
--pcap FILEthe point cloud and IMU come from a capture instead of the generator. The file is read withtools/livox_mid360_pcap.py: classic pcap only (convert pcapng witheditcap -F pcap), Ethernet (with VLAN), raw IPv4 or Linux cooked, IPv4 UDP. Every datagram sent from a LiDAR data port (push 56200, point cloud 56300, IMU 56400, log 56500) is replayed byte for byte, from the simulator's socket of that stream to the host the SDK configured for it (keys0x0005,0x0006,0x0007,0x0009); one without a host is counted asskipped. Command traffic in the capture (discovery,0x0100, their ACKs) is not replayed: theDeviceModelanswers the SDK as usual, so a replay connects like the live simulator. The replay starts once the work state is SAMPLING and a host is configured for one of these streams (usually by the SDK's first0x0100), keeps the recorded spacing divided by--pcap-rate, then runs to the end of the file whatever the work state, and ends withreplay_done. It runs once; afterwards no point cloud or IMU is sent. From the first replayed push toreplay_donethe capture's pushes replace the simulator's own, which then resume. Packets keep their recordedudp_cnt,frame_cntand timestamps. The capture should hold one LiDAR: datagrams from several are replayed as if they were one.tests/data/replay.pcapis a synthetic capture written bytools/gen_replay_pcap.py(three frames of eight ring-scene packets, twelve IMU packets, two pushes withcore_temp43.21 °C, one log chunk, and command and unrelated traffic that must be skipped); CI regenerates it and fails on a difference. - FOV cropping: when
fov_cfg_enenables at least one window, a point outside every enabled window stays in its packet as (0, 0, 0) with reflectivity 60 and tag 0, so every packet keeps 96 points and an empty window zeroes them all, as on a Mid-360 (#246; measured in Cartesian32, [unverified] that spherical points zero depth, theta and phi alike). The window test: yaw[start, stop), sostart == stopis empty; pitch[start, stop]; no wrap-around, since a reversed window is rejected (measured in #11). Cartesian points useyaw = atan2(y, x),pitch = atan2(z, hypot(x, y)); spherical onesphiand90° - theta. The ring scene crops its next 96 points on their exact angles, whatever the data type, so the kept set is known: a window of yaw[0, 90)and pitch[0, 15]keeps exactly thek < 64withk % 4in {0, 1}.
Tests¶
python3 -m unittest tools/test_sim.py: the pureDeviceModel(transitions, configure rules, reboot / factory-reset persistence, GPS time, push payload), theLidarClock(power-on time, drift, steps, loss without a step),PointSourcedeterminism, and an in-process end-to-end run over UDP (discovery → configure → packets → push → reboot silence →udp_cntreset;hmsanddrop_ackcontrols), the packet fault controls on both data streams, and the ring scene in every data type and under a FOV window, the--apply-attitudetransform, and thetime_synccontrol on the packets'time_typeand timestamps.PcapReplayTestreplaystests/data/replay.pcapinto sockets and compares every datagram byte for byte with the capture, and checks the start condition, the skipped streams, the rate and the push hand-over.-
tests/test_sim_smoke.cpp(Catch2, tag[sim]): spawns the simulator withposix_spawnthroughtests/sim_process.hpp, then discovery → 0x0100 → wait for SAMPLING via 0x0101 → receive ≥ 200 point-cloud and ≥ 10 IMU packets throughUdpSocket/Poller→ quit. The test is skipped when no Python interpreter is found; CMake passesPython3_EXECUTABLEasLIVOX_MID360_PYTHONand the script path asLIVOX_MID360_SIM_SCRIPT. -
tests/test_scene.cpp(tag[scene][sim]): aDeviceagainst--scene ringdecodes every data type to the expected points (position, tag,line, per-pointoffset_ns), keeps exactly the expected points under a FOV window, applies a host-side extrinsic, and records spherical packets to lvx2 that read back as the same points. With--apply-attitudethe Cartesian frames equal the scene moved by key0x0012, spherical ones stay as they are, and anextrinsic_from()on top gives the double transform. tests/test_replay.cpp(tag[replay][sim]):--pcap tests/data/replay.pcapinto aDevice, which counts exactly the capture's packets, frames, points, IMU samples and pushes, no drops, and reports the recordedcore_temp.tests/test_time_sync.cpp(tag[time][sim]): frames start on the power-on clock; after aptpstepkLidarframes carry the master time andFrame::time_typechanges between two frames;time_sync_status()and the push report the step; a loss keeps the time without a step back.kHostOffsetOncepasses synchronised time through without touching its offset, measures it again after the loss, and keeps its first offset while a 10 % drift carries the frames away from the host clock.
SimProcess::control() sends any control line and wait_event() blocks for a matching
stdout line, so later session-layer tests can inject reboots, HMS codes or dropped ACKs.
Assumptions to verify on hardware (#11)¶
| Topic | Simulator behaviour | Why unverified |
|---|---|---|
dev_type in the discovery ACK |
9 (--dev-type) |
verified: a Mid-360 (firmware 13.18.0244) reports 9 |
| Unicast discovery | answered like broadcast | verified on the same subnet: answered, but the ACK goes to 255.255.255.255 (--discovery-ack-broadcast, #217); from outside the broadcast domain still unverified |
Discovery ACK cmd_port |
the bound command port (56100 by default) | verified: 56100 |
| Persistence across reboot | all keys, work_tgt_mode included; src_port of 0x0005–0x0007 reads back 0 |
verified on firmware 13.18.0244 for the keys a host writes (#12, #250); the wiki marks work_tgt_mode as volatile, the firmware keeps it |
| Reboot timing (#236) | runs on for --reboot-delay (0.3 s), one ERROR push, --reboot-silence (0.5 s), then MOTORSTARTUP → target; udp_cnt and the clock restart |
measured on firmware 13.18.0244: runs on for 1.25 s, ERROR pushes, silent until +8.9 s, first push MOTORSTARTUP (SELFCHECK / IDLE never pushed), READY at +13.5 s, then SAMPLING; the defaults stay short to keep tests fast |
| SELFCHECK / MOTORSTARTUP | 0.1 s / 0.3 s, commands answered | SELFCHECK unknown; MOTORSTARTUP measured at 6.1–10.1 s on a Mid-360 (#221), kept short here to keep the tests fast |
work_tgt_mode rejections |
0x03 for anything but 1 / 2 / 9; 0x02 in ERROR / UPGRADE |
0x03 measured on firmware 13.18.0244 for 0, 3–7 and 10 (#11); 8 and the ERROR / UPGRADE answer are not |
| Write of a read-only key | ret 0x20, error_key = that key |
verified on firmware 13.18.0244 (#11); the wiki lists 0x22 for it |
| Unknown key | ret 0x20 |
verified on firmware 13.18.0244 (#11) |
0x0101 inquire with an unknown key |
ret 0x20 with the known keys, the unknown ones left out |
verified on firmware 13.18.0244 (#228); a request naming only unknown keys gets key_num 0 |
detect_mode / time_filter values > 1, imu_data_en |
ret 0x03; imu_data_en stored as written |
measured for detect_mode 2 and imu_data_en 2 (#11); 13.18.0244 does not support time_filter, and imu_data_en above 2 is not checked |
imu_sensor_cfg |
per-byte range → 0x03; accepted rate switches the IMU stream to 200 / 500 / 100 / 50 pkt/s at once (and time_interval); factory default 0/0/0; --imu-cfg-unsupported → 0x20 on write and read |
the wiki gives no default, no firmware version and does not say whether the rate change is immediate |
| Free-running clock | counts from power-on at the host's rate (plus drift_ppm), restarts at 0 at a reboot |
the protocol says only "counts from power-on" (#133, #109) |
| Time sync acquired / lost | a step to the master time; 0x800A = the master time, 0x800B = local − source at the step; a loss continues from the current time, 0x800A / 0x800B unchanged; a reboot loses it |
how the firmware steps, slews or refreshes these keys (#109) |
0x0202 GPS time |
the request's arrival is taken as the PPS edge; answered 0x00 whatever the PPS input |
the LiDAR latches the PPS edge in hardware |
time_filter |
stored only; the simulator has no time source to roll back | key 0x0026 is not supported on 13.18.0244 (#11), so the rollback behaviour cannot be checked there |
lidar_ipcfg write |
ret 0x21 (reboot required) when the value changes, 0x03 for a value lidar_ip_config_valid() rejects |
on 13.18.0244 the current value answers 0x00, the rejected values 0x03, and no other key answers 0x21 (#11); a changed value needs a reboot to check (#12) |
Unknown cmd_id |
no ACK | verified on firmware 13.18.0244 (#11) |
| Multi-key config with one bad key | nothing applied | verified on firmware 13.18.0244 (#11) |
| Push contents and timing | keys 0x0000, 0x0001, 0x0004–0x0007, 0x0012, 0x0015–0x0019, 0x001A, 0x001C, then 0x8000–0x800C, 0x800E, 0x8010, 0x8011; an extra push on each state change and after each 0x0100 request |
verified on firmware 13.18.0244 (#235); the real push seq_num is not contiguous (about 26 per second at one push per second), the simulator's counts its own pushes |
| Debug raw data (#93, #106) | 0x0303 answers 0x00 on the log port in every work state, also when repeated (the stream then moves to the new destination), when disabling a disabled stream and for an enable with port 0 (which stops the stream); the command port does not answer; short payloads answer 0x01; the stream leaves port 60301 only while sampling, does not stop the point cloud and ends with a reboot; the datagram content is synthetic |
verified on firmware 13.18.0244 except the datagram content |
| Firmware log (#44) | 0x0301 on the log socket enables / disables a type, ret 0x00 even when repeated or for an undefined log_type; chunks go to key 0x0009 (else to the 0x0301 sender); file_index starts at 1, trans_index at 0 with the begin flag, file_num is 0 in that chunk and 1 afterwards, timestamp is 0; a disable sends no end chunk (#244) |
firmware 13.18.0244 rejects key 0x0009 with 0x20 and sends to the 0x0301 sender (--log-ignore-hostcfg plus a fail_cmd on key 9 reproduce it, #223), resends an unacknowledged chunk, answers 0x0301 with 0x00 in every case (an undefined log_type included) and does not answer 0x0302 (#11); how a file ends is unknown |
| FOV window ranges | yaw outside [0, 360], pitch outside [-10, 60] or start > stop → 0x03; equal start-stop accepted (measured) |
the wiki gives half-open ranges; a Mid-360 includes both ends |
| FOV write while SAMPLING | applied at once, ret 0x00 (no 0x21) |
the wiki does not say whether FOV keys need a reboot or a motor restart |
pcl_data_type change while SAMPLING |
the next packet is already in the new format and udp_cnt skips one value (--type-switch-gap) |
measured on firmware 13.18.0244 (#11): the switch is immediate (1.3–3 ms), not aligned to a frame, and udp_cnt skips one value at every switch |
pattern_mode |
0 / 1 / 2 accepted, above → 0x03; a change while SAMPLING or READY restarts the motor (MOTORSTARTUP for --startup-delay, READY, then the target), the same value does not |
measured on firmware 13.18.0244 (#11): the restart takes 1.0 s from SAMPLING; whether 1 / 2 change the scan is not known, the simulator's points do not change |
Install attitude 0x0012 |
stored only; with --apply-attitude, Cartesian points moved by Rz * Ry * Rx + translation after the FOV crop, spherical untouched |
firmware 13.18.0244 does not apply the key to its output and accepts any angle (roll 200°, yaw −181°) (#11) |
| FOV cropping | yaw [start, stop), start == stop empty; pitch [start, stop]; keep if inside any enabled window, else a zero point with reflectivity 60 (measured) |
the wiki defines neither the edge inclusivity nor how the windows combine |
| Inquire of all settings / status keys at once | one ACK with every key | verified on firmware 13.18.0244: one ACK for all 16 settings keys and for all status keys (#11) |
frame_cnt period |
none: stays 0, as on a Mid-360 (#246); --frame-ms for tests |
the wiki marks frame_cnt invalid for a non-repetitive scanner. Livox's sample .lvx2 files have frame_counter 0 in every package, but the LVX2 spec marks that field reserved, so they say nothing about the firmware (#164, lvx2.md); a Mid-360 on 13.18.0244 was seen to keep it 0 |