TimeSampleStorage#

Fully qualified name: isaacsim::core::simulation_manager::TimeSampleStorage

Structs Summary#

Entry

Entry in the circular buffer.

TimeData

Time data stored for each sample.

class TimeSampleStorage#

Thread-safe circular buffer storage for simulation time data.

Stores simulation time data at specific RationalTime timestamps using an integrated circular buffer. The class maintains three time values per sample:

  • simTime: The current simulation time

  • simTimeMonotonic: Monotonic simulation time that doesn’t reset

  • systemTime: System clock time

Key features:

  • RationalTime precision for accurate time representation

  • FSD-compatible time retrieval with automatic fallback to timeline

  • Robust time matching that handles equivalent fractions (e.g., 604/30 equals 302/15)

  • Linear interpolation for queries between stored samples

  • Bounded memory usage with automatic FIFO eviction when buffer is full

  • Direct memory access for optimal performance

  • Thread-safe operations with single-writer, multiple-reader pattern

Public Functions

TimeSampleStorage(omni::fabric::UsdStageId stageId)#

Constructor.

Parameters:

stageId[in] The USD stage ID for accessing stage frame time

omni::fabric::RationalTime getCurrentTime()#

Get current frame time from StageReaderWriter.

Uses StageReaderWriter’s getFrameTime() to provide the correct frame time that corresponds to when we are reading/writing time data. This ensures temporal consistency between time sample storage and frame timing.

Returns:

Current rational time or kInvalidRationalTime if unavailable

bool storeSample(
double simTime,
double simTimeMonotonic,
double systemTime,
)#

Store simulation time data at the current timestamp the current timestamp is returned by getCurrentTime()

Parameters:
  • simTime[in] The simulation time value

  • simTimeMonotonic[in] The monotonic simulation time value

  • systemTime[in] The system time value

Returns:

true if successful, false if current time could not be determined

std::optional<double> getSimulationTimeAt(
const omni::fabric::RationalTime &time,
)#

Get simulation time at a specific timestamp.

Note

First attempts exact match, then falls back to linear interpolation between adjacent samples

Parameters:

time[in] The rational time to look up

Returns:

The simulation time value (exact or interpolated), std::nullopt if no data available

std::optional<double> getMonotonicSimulationTimeAt(
const omni::fabric::RationalTime &time,
)#

Get monotonic simulation time at a specific timestamp.

Note

First attempts exact match, then falls back to linear interpolation between adjacent samples

Parameters:

time[in] The rational time to look up

Returns:

The monotonic simulation time value (exact or interpolated), std::nullopt if no data available

std::optional<double> getSystemTimeAt(
const omni::fabric::RationalTime &time,
)#

Get system time at a specific timestamp.

Note

First attempts exact match, then falls back to linear interpolation between adjacent samples

Parameters:

time[in] The rational time to look up

Returns:

The system time value (exact or interpolated), std::nullopt if no data available

std::vector<Entry> getAllSamples() const#

Get all valid samples from the buffer.

Note

Thread-safe - acquires shared lock internally

Returns:

Vector of all valid samples in chronological order

size_t getSampleCount() const#

Get count of stored samples.

Returns:

Number of samples with data

std::optional<std::pair<omni::fabric::RationalTime, omni::fabric::RationalTime>> getSampleRange(
) const#

Get the time range of stored samples.

Returns:

Pair of (earliest_time, latest_time) if samples exist, nullopt otherwise

void clear()#

Clear all stored samples.

void logStatistics() const#

Log storage statistics for debugging.

Note

This method is thread-safe and does not modify the storage

Public Static Functions

static inline constexpr size_t getBufferCapacity()#

Get maximum buffer capacity.

Returns:

Maximum number of samples that can be stored in the buffer

static bool isValidTime(const omni::fabric::RationalTime &time)#

Validate a RationalTime value.

Note

Checks for zero denominator and potential overflow conditions

Parameters:

time[in] The time to validate

Returns:

true if the time is valid, false otherwise

struct Entry#

Entry in the circular buffer.

Public Members

omni::fabric::RationalTime time#

Rational time code for this sample.

TimeData data#

Time data associated with this sample.

bool valid = false#

Whether this entry contains valid data.

struct TimeData#

Time data stored for each sample.

Public Members

double simTime#

Simulation time in seconds (may reset on timeline stop).

double simTimeMonotonic#

Monotonically increasing simulation time in seconds.

double systemTime#

Wall-clock system time in seconds.