feat(record): add depth RVL recording to MCAP
This commit is contained in:
@@ -83,6 +83,7 @@ struct McapRecordConfig {
|
||||
bool enabled{false};
|
||||
std::string path{"capture.mcap"};
|
||||
std::string topic{"/camera/video"};
|
||||
std::string depth_topic{"/camera/depth"};
|
||||
std::string frame_id{"camera"};
|
||||
McapCompression compression{McapCompression::Zstd};
|
||||
};
|
||||
|
||||
@@ -45,6 +45,12 @@ enum class PixelFormat : std::uint8_t {
|
||||
YUYV,
|
||||
};
|
||||
|
||||
enum class DepthUnit : std::uint8_t {
|
||||
Unknown = 0,
|
||||
Millimeter = 1,
|
||||
Meter = 2,
|
||||
};
|
||||
|
||||
enum class ModuleStatus : std::int32_t {
|
||||
Online = 0xa1,
|
||||
Offline = 0xa0,
|
||||
@@ -57,6 +63,7 @@ enum class ParseError {
|
||||
InvalidMagic,
|
||||
UnsupportedVersion,
|
||||
InvalidDepth,
|
||||
InvalidDepthUnit,
|
||||
InvalidPixelFormat,
|
||||
InvalidModuleStatus,
|
||||
PayloadLengthMismatch,
|
||||
@@ -155,11 +162,23 @@ struct ControlResponseMessage {
|
||||
|
||||
struct ValidatedShmView {
|
||||
FrameMetadata metadata;
|
||||
DepthUnit depth_unit{DepthUnit::Unknown};
|
||||
std::span<const std::uint8_t> payload;
|
||||
std::span<const std::uint8_t> left;
|
||||
std::optional<FrameInfo> depth_info{};
|
||||
std::span<const std::uint8_t> depth{};
|
||||
std::optional<FrameInfo> confidence_info{};
|
||||
std::span<const std::uint8_t> confidence{};
|
||||
};
|
||||
|
||||
struct CoherentSnapshot {
|
||||
FrameMetadata metadata;
|
||||
DepthUnit depth_unit{DepthUnit::Unknown};
|
||||
std::span<const std::uint8_t> left;
|
||||
std::optional<FrameInfo> depth_info{};
|
||||
std::span<const std::uint8_t> depth{};
|
||||
std::optional<FrameInfo> confidence_info{};
|
||||
std::span<const std::uint8_t> confidence{};
|
||||
std::size_t bytes_copied;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,13 +2,30 @@
|
||||
|
||||
#include "cvmmap_streamer/config/runtime_config.hpp"
|
||||
#include "cvmmap_streamer/encode/encoded_access_unit.hpp"
|
||||
#include "cvmmap_streamer/ipc/contracts.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace cvmmap_streamer::record {
|
||||
|
||||
enum class DepthEncoding {
|
||||
RvlU16Lossless,
|
||||
RvlF32,
|
||||
};
|
||||
|
||||
struct RawDepthMapView {
|
||||
std::uint64_t timestamp_ns{0};
|
||||
std::uint32_t width{0};
|
||||
std::uint32_t height{0};
|
||||
ipc::DepthUnit source_unit{ipc::DepthUnit::Unknown};
|
||||
std::span<const float> pixels{};
|
||||
};
|
||||
|
||||
class McapRecordSink {
|
||||
public:
|
||||
McapRecordSink() = default;
|
||||
@@ -31,6 +48,9 @@ public:
|
||||
[[nodiscard]]
|
||||
std::expected<void, std::string> write_access_unit(const encode::EncodedAccessUnit &access_unit);
|
||||
|
||||
[[nodiscard]]
|
||||
std::expected<void, std::string> write_depth_map(const RawDepthMapView &depth_map);
|
||||
|
||||
[[nodiscard]]
|
||||
bool is_open() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user