13#include "xrt/xrt_config_build.h"
30namespace xrt::tracking::constellation {
34struct ConstellationTracker;
38namespace xrt::tracking::constellation::optimizer::rig_calibration {
40using namespace xrt::tracking::constellation;
41namespace os = xrt::auxiliary::os;
61 std::array<xrt_vec2, XRT_CONSTELLATION_MAX_LEDS_PER_DEVICE>
points2d;
63 std::array<xrt_vec3, XRT_CONSTELLATION_MAX_LEDS_PER_DEVICE>
points3d;
69 std::vector<DeviceCameraSample> camera_samples;
70 std::vector<xrt_imu_sample> imu_samples;
154 std::vector<CameraCalibration> cameras;
155 std::vector<KeyframeCalibration> keyframes;
173 std::map<t_constellation_device_id_t, DeviceSamples> device_samples;
174 std::vector<CameraDescription> cameras;
175 mutable os::Mutex lock;
176 bool collecting_data{
false};
178#ifdef XRT_FEATURE_RERUN
179 std::unique_ptr<struct RerunContext> rerun_context{
nullptr};
218 numSamplesForBestDevice(
size_t &out_num_samples)
const;
223 bestDeviceLocked(t_constellation_device_id_t &out_device)
const;
226 getDeviceSamplesLocked(t_constellation_device_id_t device_id);
245 solveWithCameraTimeOffset(t_constellation_device_id_t device_id,
246 const std::vector<CameraDescription> &cameras,
247 std::vector<DeviceCameraSample> camera_samples,
248 const std::vector<xrt_imu_sample> &imu_samples,
u_logging_level
Logging level enum.
Definition u_logging.h:45
int64_t timepoint_ns
Integer timestamp type.
Definition u_time.h:77
int64_t time_duration_ns
Integer duration type in nanoseconds.
Definition u_time.h:88
Generic math helpers for constellation optimizer code.
Wrapper around OS threading native functions.
RANSAC PnP pose refinement.
Definition camera_model.h:21
Definition t_constellation_tracker_internal.hpp:128
Definition t_constellation_tracker_internal.hpp:453
How well one kind of sensor was fit, so that a bad solve can be attributed to the sensor that could n...
Definition math.hpp:31
The output of a successful RigCalibration::optimize call.
Definition rig_calibration.hpp:146
int iterations
How many iterations the solver took.
Definition rig_calibration.hpp:166
double initial_cost
Solver cost before the solve, 1/2 ||f(x_0)||^2.
Definition rig_calibration.hpp:162
double final_cost
Solver cost after the solve, 1/2 ||f(x)||^2.
Definition rig_calibration.hpp:164
FactorFitness imu_fitness
How well each kind of factor was fit at the solution.
Definition rig_calibration.hpp:158
double gravity_mag
The magnitude of gravity, in meters per second squared. Shared by every device the solve covered.
Definition rig_calibration.hpp:153
t_constellation_device_id_t device_id
The device whose samples the solve ran on.
Definition rig_calibration.hpp:149
The pose the calibration ended up with for a single camera.
Definition rig_calibration.hpp:112
camera_model params
Carried through from the description, so a consumer can reproject the observations this pose was fit ...
Definition rig_calibration.hpp:121
bool is_2dof
True when the camera was pinned at the origin with only its pitch and roll free.
Definition rig_calibration.hpp:126
bool optimized
False when the pose was handed to the optimizer as a constraint instead of being solved for.
Definition rig_calibration.hpp:124
xrt_pose Tcv_world_cam
The pose of the camera, in OpenCV space.
Definition rig_calibration.hpp:118
Definition rig_calibration.hpp:77
camera_model params
Intrinsics and distortion, which is what turns a LED in the device's frame into a pixel.
Definition rig_calibration.hpp:83
xrt_pose Tcv_world_cam
Where the camera sits in the world, in OpenCV space. Only read when has_concrete_pose is set.
Definition rig_calibration.hpp:86
bool has_concrete_pose
Whether the camera has a concrete pose, in which case Tcv_world_cam is where it is held for the whole...
Definition rig_calibration.hpp:92
One camera's view of one device at one exposure, as the LED correspondences the tracker labelled.
Definition rig_calibration.hpp:47
xrt_pose Tcv_cam_device_seed
The seed pose that the tracker recovered.
Definition rig_calibration.hpp:57
std::array< xrt_vec3, XRT_CONSTELLATION_MAX_LEDS_PER_DEVICE > points3d
The 3D blob points, in the device's frame. Same order as points2d.
Definition rig_calibration.hpp:63
std::array< xrt_vec2, XRT_CONSTELLATION_MAX_LEDS_PER_DEVICE > points2d
The 2D blob points.
Definition rig_calibration.hpp:61
Definition rig_calibration.hpp:67
The IMU intrinsics the calibration solved for.
Definition rig_calibration.hpp:97
xrt_quat Qcv_model_imu
The LED model -> IMU rotation.
Definition rig_calibration.hpp:107
xrt_vec3_f64 accel_bias
Accelerometer bias, in meters per second squared.
Definition rig_calibration.hpp:100
xrt_vec3_f64 gyro_bias
Gyroscope bias, in radians per second.
Definition rig_calibration.hpp:102
xrt_vec3_f64 accel_scale
Per-axis accelerometer scale, unitless.
Definition rig_calibration.hpp:104
The device state the calibration solved for at a single keyframe.
Definition rig_calibration.hpp:131
xrt_pose Tcv_world_device
The world -> LED model pose of the device, in OpenCV space.
Definition rig_calibration.hpp:136
xrt_vec3 velocity_m_s
The linear velocity of the device in world space, in meters per second, in OpenCV space.
Definition rig_calibration.hpp:138
std::vector< DeviceCameraSample > camera_samples
The camera observations which constrained this keyframe.
Definition rig_calibration.hpp:141
Definition rig_calibration.hpp:170
void pushCameraSample(ConstellationTracker *tracker, const CameraSample &sample)
Pushes a complete camera sample. Must be called with tracker->device_lock held.
Definition rig_calibration.cpp:1195
bool isCollectingData()
Returns whether the rig calibration is currently collecting data.
Definition rig_calibration.cpp:1188
bool optimize(CalibrationResult &out_result)
Runs the optimizer on the data that has been passed.
Definition rig_calibration.cpp:1299
void endCollectingData()
Ends collecting data for the rig optimization.
Definition rig_calibration.cpp:1181
void addCamera(const CameraDescription &camera_description)
Adds a camera to the rig with an optional anchored world pose.
Definition rig_calibration.cpp:1164
void pushImuSample(t_constellation_device_id_t device_id, const xrt_imu_sample &sample)
Pushes an IMU sample for this particular device, IMU samples should be in OpenXR coordinate space.
Definition rig_calibration.cpp:1280
void beginCollectingData()
Begins collecting data for the rig optimization.
Definition rig_calibration.cpp:1172
IMU Sample.
Definition xrt_tracking.h:143
A pose composed of a position and orientation.
Definition xrt_defines.h:522
A quaternion with single floats.
Definition xrt_defines.h:246
A 3 element vector with single doubles.
Definition xrt_defines.h:322
A 3 element vector with single floats.
Definition xrt_defines.h:310
Header defining the tracking system integration in Monado.