Monado OpenXR Runtime
Loading...
Searching...
No Matches
pose_optimize.hpp
Go to the documentation of this file.
1// Copyright 2015, Philipp Zabel
2// Copyright 2020-2023
3// Copyright 2026, Beyley Cardellio
4// SPDX-License-Identifier: BSL-1.0
5/*!
6 * @file
7 * @brief RANSAC PnP pose refinement
8 * @author Philipp Zabel <philipp.zabel@gmail.com>
9 * @author Jan Schmidt <jan@centricular.com>
10 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
11 * @ingroup tracking
12 */
13
14#pragma once
15
16#include "xrt/xrt_defines.h"
17
19
21
22
23namespace xrt::tracking::constellation::optimizer {
24
25enum class PoseStateIndex : int
26{
27 // Pos
28 PosX = 0,
29 PosY = 1,
30 PosZ = 2,
31
32 // Quat (must match xrt_quat/Eigen ordering)
33 RotX = 3,
34 RotY = 4,
35 RotZ = 5,
36 RotW = 6,
37
38 NumIndices,
39};
40
41constexpr int kPoseStatePosStart = static_cast<int>(PoseStateIndex::PosX);
42constexpr int kPoseStateRotStart = static_cast<int>(PoseStateIndex::RotX);
43constexpr int kPoseStateSize = static_cast<int>(PoseStateIndex::NumIndices);
44
45/*!
46 * Does a pose optimization and RANSAC refinement on the given blobs and LED model, returning the optimized pose.
47 *
48 * @param log_level The logging level to use for debug output.
49 * @param params The camera model parameters.
50 * @param init_pose The initial pose estimate to start the optimization from.
51 * @param blobs The array of blobs to use for the optimization, will write to here to unmark outliers.
52 * @param num_blobs The number of blobs in the array.
53 * @param leds_model The LED model to use for the optimization.
54 * @param device_id The device ID to optimize the pose for.
55 * @param[out] out_pose The optimized pose will be written to this variable.
56 *
57 * @return true if the optimization was successful, false otherwise.
58 */
59bool
61 bool deterministic,
62 const camera_model &params,
63 xrt_pose init_pose,
64 t_blob *blobs,
65 uint32_t num_blobs,
67 t_constellation_device_id_t device_id,
68 xrt_pose &out_pose);
69
70}; // namespace xrt::tracking::constellation::optimizer
Constellation tracker's camera model storage.
u_logging_level
Logging level enum.
Definition u_logging.h:45
bool optimizePose(u_logging_level log_level, bool deterministic, const camera_model &params, xrt_pose init_pose, t_blob *blobs, uint32_t num_blobs, t_constellation_tracker_led_model *leds_model, t_constellation_device_id_t device_id, xrt_pose &out_pose)
Does a pose optimization and RANSAC refinement on the given blobs and LED model, returning the optimi...
Definition pose_optimize.cpp:222
Definition camera_model.h:21
A blob is a 2d position in a camera sensor's view that is being tracked.
Definition t_constellation.h:51
The LED model is a series of points which define the real-world positions of all LEDs.
Definition t_constellation.h:313
A pose composed of a position and orientation.
Definition xrt_defines.h:535
Header defining the tracking system integration in Monado.
Common defines and enums for XRT.