livox_mid360_core
C++ driver library for the Livox Mid-360 LiDAR
Loading...
Searching...
No Matches
livox::mid360::Lvx2Writer Class Reference

Writes an lvx2 file from raw data packets. More...

#include <livox/mid360/lvx2.hpp>

Classes

struct  Stats
 Counters of the file being written. More...

Public Member Functions

 Lvx2Writer (const Lvx2Writer &)=delete
Lvx2Writer & operator= (const Lvx2Writer &)=delete
 Lvx2Writer (Lvx2Writer &&) noexcept
 Takes over the other writer's file; the moved-from writer must not be used again.
Lvx2Writer & operator= (Lvx2Writer &&) noexcept
 Takes over the other writer's file; the moved-from writer must not be used again.
std::expected< void, Lvx2Error > open (const std::filesystem::path &path, std::span< const Lvx2DeviceInfo > devices, std::uint32_t frame_duration_ms=50)
 Creates (truncates) path and writes the headers.
std::expected< bool, Lvx2Error > write (std::size_t device_index, const DataPacketView &packet)
 Appends one packet for devices[device_index].
std::expected< void, Lvx2Error > close ()
 Flushes the open frame and closes the file. Idempotent.
bool is_open () const noexcept
 True between a successful open() and close().
Stats stats () const noexcept
 Counters since the last open().

Detailed Description

Writes an lvx2 file from raw data packets.

Frames are cut every frame_duration_ms of recording time, which starts at the first package; each device's timestamps join it at the device's first package and after a clock jump (docs/lvx2.md). Spherical packets are converted to Cartesian32; IMU packets are ignored (write() returns false). Not thread-safe; call from one thread (the on_packet callback is fine).

Member Function Documentation

◆ open()

std::expected< void, Lvx2Error > livox::mid360::Lvx2Writer::open ( const std::filesystem::path & path,
std::span< const Lvx2DeviceInfo > devices,
std::uint32_t frame_duration_ms = 50 )
nodiscard

Creates (truncates) path and writes the headers.

devices must not be empty. The spec fixes frame_duration_ms at 50 for version 2.0.0.0; other values make files that other readers may refuse (#174).

◆ write()

std::expected< bool, Lvx2Error > livox::mid360::Lvx2Writer::write ( std::size_t device_index,
const DataPacketView & packet )
nodiscard

Appends one packet for devices[device_index].

Returns true when a package was written, false for an IMU packet.


The documentation for this class was generated from the following file: