|
livox_mid360_core
C++ driver library for the Livox Mid-360 LiDAR
|
Replays a file: packets go to on_packet as-is, and through a FrameAssembler per device (timestamps are the recorded ones, TimestampPolicy::kLidar) to on_frame / on_device_frame. More...
#include <livox/mid360/lvx2.hpp>
Public Types | |
| using | PacketCallback = std::function<void(const Lvx2Packet &)> |
| Receives every played package as read from the file. | |
| using | DeviceFrameCallback = std::function<void(const Lvx2DeviceInfo & device, Frame &&)> |
| device is the entry of devices() that the frame belongs to. | |
Public Member Functions | |
| Lvx2Player (Lvx2PlayOptions options={}) | |
| A player that is not open yet; options apply to every run(). | |
| Lvx2Player (const Lvx2Player &)=delete | |
| Lvx2Player & | operator= (const Lvx2Player &)=delete |
| Lvx2Player (Lvx2Player &&) noexcept | |
| Takes over the other player's file and callbacks; the moved-from player must not be used again. | |
| Lvx2Player & | operator= (Lvx2Player &&) noexcept |
| Takes over the other player's file and callbacks; the moved-from player must not be used again. | |
| std::expected< void, Lvx2Error > | open (const std::filesystem::path &path) |
| Opens the file for run(). | |
| const Lvx2FileHeader & | header () const noexcept |
| File header of the open file. | |
| const std::vector< Lvx2DeviceInfo > & | devices () const noexcept |
| Device-info block of the open file. | |
| void | on_packet (PacketCallback cb) |
| Every played package, before it goes to the frame assembler. | |
| void | on_frame (std::function< void(Frame &&)> cb) |
| Frames without their device. | |
| void | on_device_frame (DeviceFrameCallback cb) |
| Frames with the device they belong to; also called for a single device. | |
| std::expected< Lvx2PlayStats, Lvx2Error > | run (const std::stop_token &stop={}) |
| Plays until the end of the file (once, or forever with loop) or until stop is requested; the partial frames are flushed at the end of each pass. | |
Replays a file: packets go to on_packet as-is, and through a FrameAssembler per device (timestamps are the recorded ones, TimestampPolicy::kLidar) to on_frame / on_device_frame.
Frames are closed by frame_policy, not by the file's 50 ms frames, and never mix devices. Each device is paced by its own clock, because unsynchronised LiDARs count from their own boot. Points stay in the LiDAR's coordinates: the file's extrinsic is not applied, and the points of one package share its time (no time_interval in the format; docs/lvx2.md, #174). Callbacks run on the calling thread.
|
nodiscard |
Opens the file for run().
Fails with kInvalidArgument when lidar_id is set but not among the file's devices (the detail names their lidar_ids).
| void livox::mid360::Lvx2Player::on_frame | ( | std::function< void(Frame &&)> | cb | ) |
Frames without their device.
When several devices are played, set on_device_frame instead (or as well): run() refuses an on_frame alone, whose frames could not be told apart (#163).
|
nodiscard |
Plays until the end of the file (once, or forever with loop) or until stop is requested; the partial frames are flushed at the end of each pass.
Frame::index starts at 0 for each call and device, and keeps counting across loop passes. Fails with kInvalidArgument when not open, or when several devices are played with on_frame set and on_device_frame not set. A read error ends the run early and is returned.