Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::Measurements Struct Reference

Archetype: One or more scalar measurements, each with a variance and a unit. More...

#include <rerun/archetypes/measurements.hpp>

Public Member Functions

 Measurements (Measurements &&other)=default
 
 Measurements (const Measurements &other)=default
 
Measurementsoperator= (const Measurements &other)=default
 
Measurementsoperator= (Measurements &&other)=default
 
 Measurements (Collection< rerun::components::Scalar > _values)
 
Measurements with_values (const Collection< rerun::components::Scalar > &_values) &&
 The measured scalar values.
 
Measurements with_variances (const Collection< rerun::components::Variance > &_variances) &&
 Variances of the measurements (σ², in the units of values squared).
 
Measurements with_units (const Collection< rerun::components::Unit > &_units) &&
 Units of the measurements, shown in the legend and in tooltips.
 
Measurements with_colors (const Collection< rerun::components::Color > &_colors) &&
 Color for the corresponding series.
 
Measurements with_widths (const Collection< rerun::components::StrokeWidth > &_widths) &&
 Stroke width for the corresponding series.
 
Measurements with_names (const Collection< rerun::components::Name > &_names) &&
 Display name of the series.
 
Measurements with_visible_series (const Collection< rerun::components::Visible > &_visible_series) &&
 Which series are visible.
 
Measurements with_aggregation_policy (const rerun::components::AggregationPolicy &_aggregation_policy) &&
 Configures the zoom-dependent scalar aggregation.
 
Measurements with_many_aggregation_policy (const Collection< rerun::components::AggregationPolicy > &_aggregation_policy) &&
 This method makes it possible to pack multiple aggregation_policy in a single component batch.
 
Measurements with_interpolation_mode (const rerun::components::InterpolationMode &_interpolation_mode) &&
 Specifies how values between data points are interpolated.
 
Measurements with_many_interpolation_mode (const Collection< rerun::components::InterpolationMode > &_interpolation_mode) &&
 This method makes it possible to pack multiple interpolation_mode in a single component batch.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static Measurements update_fields ()
 Update only some specific fields of a Measurements.
 
static Measurements clear_fields ()
 Clear all the fields of a Measurements.
 

Public Attributes

std::optional< ComponentBatchvalues
 The measured scalar values.
 
std::optional< ComponentBatchvariances
 Variances of the measurements (σ², in the units of values squared).
 
std::optional< ComponentBatchunits
 Units of the measurements, shown in the legend and in tooltips.
 
std::optional< ComponentBatchcolors
 Color for the corresponding series.
 
std::optional< ComponentBatchwidths
 Stroke width for the corresponding series.
 
std::optional< ComponentBatchnames
 Display name of the series.
 
std::optional< ComponentBatchvisible_series
 Which series are visible.
 
std::optional< ComponentBatchaggregation_policy
 Configures the zoom-dependent scalar aggregation.
 
std::optional< ComponentBatchinterpolation_mode
 Specifies how values between data points are interpolated.
 

Static Public Attributes

static constexpr const char ArchetypeName [] = "rerun.archetypes.Measurements"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_values
 ComponentDescriptor for the values field.
 
static constexpr auto Descriptor_variances
 ComponentDescriptor for the variances field.
 
static constexpr auto Descriptor_units
 ComponentDescriptor for the units field.
 
static constexpr auto Descriptor_colors
 ComponentDescriptor for the colors field.
 
static constexpr auto Descriptor_widths
 ComponentDescriptor for the widths field.
 
static constexpr auto Descriptor_names
 ComponentDescriptor for the names field.
 
static constexpr auto Descriptor_visible_series
 ComponentDescriptor for the visible_series field.
 
static constexpr auto Descriptor_aggregation_policy
 ComponentDescriptor for the aggregation_policy field.
 
static constexpr auto Descriptor_interpolation_mode
 ComponentDescriptor for the interpolation_mode field.
 

Detailed Description

Archetype: One or more scalar measurements, each with a variance and a unit.

Use this for sensors that report a value together with its uncertainty: pressure, temperature, illuminance, relative humidity, range, and so on.

In a views::TimeSeriesView each series is drawn as a line with a translucent band around it, one standard deviation (the square root of the variance) wide in each direction. Leave variances unset if the uncertainty is unknown.

The current timeline value is used for the time/X-axis, so measurements should not be static. Number of values per timestamp is expected to be the same over time.

Unlike archetypes::Scalars, this archetype carries its own styling, so values and style are logged together. Changes over time are supported for most but not all styling fields (see respective fields for details).

Example

Pressure with variance

image

#include <rerun.hpp>
#include <cmath>
int main(int argc, char* argv[]) {
const auto rec =
rerun::RecordingStream("rerun_example_measurements_simple");
rec.spawn().exit_on_failure();
// Two parallel pressure sensors (in Pa), each with slowly drifting variance.
for (int step = 0; step <64; ++step) {
rec.set_time_sequence("step", step);
const auto s = static_cast<double>(step);
const std::array<double, 2> pressures = {
101325.0 + 50.0 * std::sin(s / 10.0),
101300.0 + 30.0 * std::cos(s / 8.0),
};
const std::array<double, 2> variances = {
100.0 + 25.0 * std::sin(s / 7.0),
80.0 + 15.0 * std::cos(s / 11.0),
};
rec.log(
"pressure",
{"Pa"}
)
);
}
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:63
Archetype: One or more scalar measurements, each with a variance and a unit.
Definition measurements.hpp:81
std::optional< ComponentBatch > variances
Variances of the measurements (σ², in the units of values squared).
Definition measurements.hpp:88
Measurements with_variances(const Collection< rerun::components::Variance > &_variances) &&
Variances of the measurements (σ², in the units of values squared).
Definition measurements.hpp:210
Measurements with_units(const Collection< rerun::components::Unit > &_units) &&
Units of the measurements, shown in the legend and in tooltips.
Definition measurements.hpp:220

This type is unstable and may change significantly in a way that the data won't be backwards compatible.

Member Function Documentation

◆ with_variances()

Measurements rerun::archetypes::Measurements::with_variances ( const Collection< rerun::components::Variance > &  _variances) &&
inline

Variances of the measurements (σ², in the units of values squared).

When set, length is expected to match values.

◆ with_units()

Measurements rerun::archetypes::Measurements::with_units ( const Collection< rerun::components::Unit > &  _units) &&
inline

Units of the measurements, shown in the legend and in tooltips.

When set, length is expected to match values. Expected to be unchanging over time.

◆ with_colors()

Measurements rerun::archetypes::Measurements::with_colors ( const Collection< rerun::components::Color > &  _colors) &&
inline

Color for the corresponding series.

May change over time, but can cause discontinuities in the line.

◆ with_widths()

Measurements rerun::archetypes::Measurements::with_widths ( const Collection< rerun::components::StrokeWidth > &  _widths) &&
inline

Stroke width for the corresponding series.

May change over time, but can cause discontinuities in the line.

◆ with_names()

Measurements rerun::archetypes::Measurements::with_names ( const Collection< rerun::components::Name > &  _names) &&
inline

Display name of the series.

Used in the legend. Expected to be unchanging over time.

◆ with_visible_series()

Measurements rerun::archetypes::Measurements::with_visible_series ( const Collection< rerun::components::Visible > &  _visible_series) &&
inline

Which series are visible.

If not set, all series on this entity are visible. Unlike with the regular visibility property of the entire entity, any series that is hidden via this property will still be visible in the legend.

May change over time, but can cause discontinuities in the line.

◆ with_aggregation_policy()

Measurements rerun::archetypes::Measurements::with_aggregation_policy ( const rerun::components::AggregationPolicy _aggregation_policy) &&
inline

Configures the zoom-dependent scalar aggregation.

This is done only if steps on the X axis go below a single pixel, i.e. a single pixel covers more than one tick worth of data. It can greatly improve performance (and readability) in such situations as it prevents overdraw.

Expected to be unchanging over time.

◆ with_many_aggregation_policy()

Measurements rerun::archetypes::Measurements::with_many_aggregation_policy ( const Collection< rerun::components::AggregationPolicy > &  _aggregation_policy) &&
inline

This method makes it possible to pack multiple aggregation_policy in a single component batch.

This only makes sense when used in conjunction with columns. with_aggregation_policy should be used when logging a single row's worth of data.

◆ with_interpolation_mode()

Measurements rerun::archetypes::Measurements::with_interpolation_mode ( const rerun::components::InterpolationMode _interpolation_mode) &&
inline

Specifies how values between data points are interpolated.

Defaults to linear interpolation. Use one of the Step* variants for a stepped (staircase) line.

Expected to be unchanging over time.

◆ with_many_interpolation_mode()

Measurements rerun::archetypes::Measurements::with_many_interpolation_mode ( const Collection< rerun::components::InterpolationMode > &  _interpolation_mode) &&
inline

This method makes it possible to pack multiple interpolation_mode in a single component batch.

This only makes sense when used in conjunction with columns. with_interpolation_mode should be used when logging a single row's worth of data.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::Measurements::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::Measurements::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ variances

std::optional<ComponentBatch> rerun::archetypes::Measurements::variances

Variances of the measurements (σ², in the units of values squared).

When set, length is expected to match values.

◆ units

std::optional<ComponentBatch> rerun::archetypes::Measurements::units

Units of the measurements, shown in the legend and in tooltips.

When set, length is expected to match values. Expected to be unchanging over time.

◆ colors

std::optional<ComponentBatch> rerun::archetypes::Measurements::colors

Color for the corresponding series.

May change over time, but can cause discontinuities in the line.

◆ widths

std::optional<ComponentBatch> rerun::archetypes::Measurements::widths

Stroke width for the corresponding series.

May change over time, but can cause discontinuities in the line.

◆ names

std::optional<ComponentBatch> rerun::archetypes::Measurements::names

Display name of the series.

Used in the legend. Expected to be unchanging over time.

◆ visible_series

std::optional<ComponentBatch> rerun::archetypes::Measurements::visible_series

Which series are visible.

If not set, all series on this entity are visible. Unlike with the regular visibility property of the entire entity, any series that is hidden via this property will still be visible in the legend.

May change over time, but can cause discontinuities in the line.

◆ aggregation_policy

std::optional<ComponentBatch> rerun::archetypes::Measurements::aggregation_policy

Configures the zoom-dependent scalar aggregation.

This is done only if steps on the X axis go below a single pixel, i.e. a single pixel covers more than one tick worth of data. It can greatly improve performance (and readability) in such situations as it prevents overdraw.

Expected to be unchanging over time.

◆ interpolation_mode

std::optional<ComponentBatch> rerun::archetypes::Measurements::interpolation_mode

Specifies how values between data points are interpolated.

Defaults to linear interpolation. Use one of the Step* variants for a stepped (staircase) line.

Expected to be unchanging over time.

◆ Descriptor_values

constexpr auto rerun::archetypes::Measurements::Descriptor_values
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:values", Loggable<rerun::components::Scalar>::ComponentType
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition measurements.hpp:138

ComponentDescriptor for the values field.

◆ Descriptor_variances

constexpr auto rerun::archetypes::Measurements::Descriptor_variances
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:variances",
Loggable<rerun::components::Variance>::ComponentType
)

ComponentDescriptor for the variances field.

◆ Descriptor_units

constexpr auto rerun::archetypes::Measurements::Descriptor_units
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:units", Loggable<rerun::components::Unit>::ComponentType
)

ComponentDescriptor for the units field.

◆ Descriptor_colors

constexpr auto rerun::archetypes::Measurements::Descriptor_colors
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:colors", Loggable<rerun::components::Color>::ComponentType
)

ComponentDescriptor for the colors field.

◆ Descriptor_widths

constexpr auto rerun::archetypes::Measurements::Descriptor_widths
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:widths",
Loggable<rerun::components::StrokeWidth>::ComponentType
)

ComponentDescriptor for the widths field.

◆ Descriptor_names

constexpr auto rerun::archetypes::Measurements::Descriptor_names
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:names", Loggable<rerun::components::Name>::ComponentType
)

ComponentDescriptor for the names field.

◆ Descriptor_visible_series

constexpr auto rerun::archetypes::Measurements::Descriptor_visible_series
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:visible_series",
Loggable<rerun::components::Visible>::ComponentType
)

ComponentDescriptor for the visible_series field.

◆ Descriptor_aggregation_policy

constexpr auto rerun::archetypes::Measurements::Descriptor_aggregation_policy
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:aggregation_policy",
Loggable<rerun::components::AggregationPolicy>::ComponentType
)

ComponentDescriptor for the aggregation_policy field.

◆ Descriptor_interpolation_mode

constexpr auto rerun::archetypes::Measurements::Descriptor_interpolation_mode
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "Measurements:interpolation_mode",
Loggable<rerun::components::InterpolationMode>::ComponentType
)

ComponentDescriptor for the interpolation_mode field.


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