This is an example that shows how to use Rerun's C++ API to log and view VRS files.
Arrows3D
, Image
, Scalar
, TextDocument
This C++ example demonstrates how to visualize VRS files with Rerun. VRS is a file format optimized to record & playback streams of sensor data, such as images, audio samples, and any other discrete sensors (IMU, temperature, etc), stored in per-device streams of time-stamped records.
The visualizations in this example were created with the following Rerun code:
void IMUPlayer::log_accelerometer(const std::array<float, 3>& accelMSec2) { _rec->log(_entity_path + "/accelerometer", rerun::Arrows3D::from_vectors({accelMSec2})); // … existing code for scalars … }
void IMUPlayer::log_accelerometer(const std::array<float, 3>& accelMSec2) { // … existing code for Arrows3D … _rec->log(_entity_path + "/accelerometer/x", rerun::Scalar(accelMSec2[0])); _rec->log(_entity_path + "/accelerometer/y", rerun::Scalar(accelMSec2[1])); _rec->log(_entity_path + "/accelerometer/z", rerun::Scalar(accelMSec2[2])); }
void IMUPlayer::log_gyroscope(const std::array<float, 3>& gyroRadSec) { _rec->log(_entity_path + "/gyroscope/x", rerun::Scalar(gyroRadSec[0])); _rec->log(_entity_path + "/gyroscope/y", rerun::Scalar(gyroRadSec[1])); _rec->log(_entity_path + "/gyroscope/z", rerun::Scalar(gyroRadSec[2])); }
void IMUPlayer::log_magnetometer(const std::array<float, 3>& magTesla) { _rec->log(_entity_path + "/magnetometer/x", rerun::Scalar(magTesla[0])); _rec->log(_entity_path + "/magnetometer/y", rerun::Scalar(magTesla[1])); _rec->log(_entity_path + "/magnetometer/z", rerun::Scalar(magTesla[2])); }
_rec->log( _entity_path, rerun::Image({ frame->getHeight(), frame->getWidth(), frame->getSpec().getChannelCountPerPixel()}, frame->getBuffer() ) );
_rec->log_timeless(_entity_path + "/configuration", rerun::TextDocument(layout_str));
You can find the build instructions here: C++ Example: VRS Viewer