Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
pose_log.h File Reference

Non-blocking pose-evidence CSV logging API. More...

#include <stddef.h>
#include <stdint.h>
#include "clock_alignment.h"
Include dependency graph for pose_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pose_clock_evidence
 Optional token-bound evidence mapping a controller pose interval to MORA time. More...
struct  pose_log_stats
 Snapshot counters for accepted, flushed, dropped, and rejected pose records. More...

Functions

int pose_log_start (const char *directory)
 Start a durable asynchronous CSV session, or disable logging when directory is empty.
int pose_log_record (const uint8_t *payload, size_t length, uint64_t receive_monotonic_us)
 Validate and enqueue a raw pose payload without clock mapping evidence.
int pose_log_record_clocked (const uint8_t *payload, size_t length, uint64_t receive_monotonic_us, const struct pose_clock_evidence *evidence)
 Validate and enqueue a pose payload with optional mapped timing provenance.
struct pose_log_stats pose_log_status (void)
 Return a synchronized snapshot of logging health and loss counters.
int pose_log_stop (void)
 Flush queued records, join the writer, and close the CSV file.

Detailed Description

Non-blocking pose-evidence CSV logging API.

Definition in file pose_log.h.

Function Documentation

◆ pose_log_record()

int pose_log_record ( const uint8_t * payload,
size_t length,
uint64_t receive_monotonic_us )

Validate and enqueue a raw pose payload without clock mapping evidence.

Returns
1 when queued, 0 when intentionally dropped due to contention/capacity, or -1 when invalid.

Enqueue a raw pose with no mapped-clock evidence.

Parameters
payloadWire-format USHER_POSE_SAMPLE bytes.
lengthMust equal the packed message size.
receive_monotonic_usUART receive timestamp from CLOCK_MONOTONIC.
Returns
1 queued, 0 best-effort drop, or -1 invalid payload.

Definition at line 296 of file pose_log.c.

◆ pose_log_record_clocked()

int pose_log_record_clocked ( const uint8_t * payload,
size_t length,
uint64_t receive_monotonic_us,
const struct pose_clock_evidence * evidence )

Validate and enqueue a pose payload with optional mapped timing provenance.

Trylock protects capture latency: logging is best-effort evidence, never a reason to block the real-time UART path.

Validate and enqueue a pose with optional token-bound FC/MORA clock evidence.

Parameters
payloadWire-format USHER_POSE_SAMPLE bytes.
lengthMust equal the packed message size.
receive_monotonic_usUART receive timestamp from CLOCK_MONOTONIC.
evidenceOptional probe and mapped interval copied into this row.
Returns
1 queued, 0 best-effort drop, or -1 malformed timing/pose data.

Definition at line 307 of file pose_log.c.

◆ pose_log_start()

int pose_log_start ( const char * directory)

Start a durable asynchronous CSV session, or disable logging when directory is empty.

Parameters
directoryWritable destination directory, optionally using ~ shorthand.
Returns
0 on active/disabled success, otherwise -1.

Start one durable CSV session; an empty path leaves optional logging disabled.

Returns
Zero on active/disabled success, otherwise -1 with errno set.

Definition at line 197 of file pose_log.c.

◆ pose_log_status()

struct pose_log_stats pose_log_status ( void )

Return a synchronized snapshot of logging health and loss counters.

Return a mutex-consistent snapshot of accepted, durable, dropped and rejected records.

Returns
Statistics from the current logging session.

Definition at line 365 of file pose_log.c.

◆ pose_log_stop()

int pose_log_stop ( void )

Flush queued records, join the writer, and close the CSV file.

Returns
0 after durable orderly shutdown, or -1 if a pending I/O error exists.

Stop accepting records, drain the queue, join the writer, and close the CSV.

Returns
Zero after orderly durable shutdown, otherwise -1 with errno set.

Definition at line 375 of file pose_log.c.