Skip to content

Commit 89d1bda

Browse files
committed
Adopt vendor-agnostic FullBodyTracker API in the C++ full-body examples
Follow-up to the generic FullBodyTracker refactor (#781), which removed deviceio_trackers/full_body_tracker_pico.hpp and renamed the Pico types: FullBodyTrackerPico -> FullBodyTracker, FullBodyPosePicoT -> FullBodyPoseT, BodyJointPico_* -> BodyJoint_*. full_body_printer and record_full_body now use the new header and names; no behavior change (the session still selects the default vendor). Both targets build, rig tests 30/30, clang-format-14 and pre-commit clean. Signed-off-by: Jiwen Cai <jiwenc@nvidia.com>
1 parent 4fdaf9a commit 89d1bda

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

examples/mcap_record_replay/cpp/record_full_body.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @file record_full_body.cpp
66
* @brief Record a live full-body tracking session to an MCAP file using only the C++ API.
77
*
8-
* C++ counterpart of record_full_body.py. Creates a FullBodyTrackerPico, opens an OpenXR
8+
* C++ counterpart of record_full_body.py. Creates a FullBodyTracker, opens an OpenXR
99
* session with its required extensions, and passes a McapRecordingConfig to
1010
* DeviceIOSession::run() — the tracker impl then writes MCAP samples during each
1111
* session->update() call. Unlike the Python example this does not launch the CloudXR runtime;
@@ -23,7 +23,7 @@
2323
*/
2424

2525
#include <deviceio_session/deviceio_session.hpp>
26-
#include <deviceio_trackers/full_body_tracker_pico.hpp>
26+
#include <deviceio_trackers/full_body_tracker.hpp>
2727
#include <oxr/oxr_session.hpp>
2828
#include <schema/full_body_generated.h>
2929

@@ -56,10 +56,10 @@ std::string default_output_path()
5656
return name.str();
5757
}
5858

59-
uint32_t count_valid_joints(const core::FullBodyPosePicoT& data)
59+
uint32_t count_valid_joints(const core::FullBodyPoseT& data)
6060
{
6161
uint32_t valid_count = 0;
62-
for (uint32_t i = 0; i < core::FullBodyTrackerPico::JOINT_COUNT; ++i)
62+
for (uint32_t i = 0; i < core::FullBodyTracker::JOINT_COUNT; ++i)
6363
{
6464
if ((*data.joints->joints())[i]->is_valid())
6565
{
@@ -80,7 +80,7 @@ try
8080
std::cout << "[record] writing " << mcap_path << " for " << duration_s << "s" << std::endl;
8181

8282
// Step 1: Create the tracker
83-
auto tracker = std::make_shared<core::FullBodyTrackerPico>();
83+
auto tracker = std::make_shared<core::FullBodyTracker>();
8484

8585
// Step 2: Get required extensions and create OpenXR session
8686
std::vector<std::shared_ptr<core::ITracker>> trackers = { tracker };
@@ -114,7 +114,7 @@ try
114114
if (tracked.data)
115115
{
116116
std::cout << " joints=" << count_valid_joints(*tracked.data) << "/"
117-
<< core::FullBodyTrackerPico::JOINT_COUNT;
117+
<< core::FullBodyTracker::JOINT_COUNT;
118118
}
119119
else
120120
{

examples/schemaio/full_body_printer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @file full_body_printer.cpp
66
* @brief Standalone application that reads and prints PICO full-body poses from the OpenXR runtime.
77
*
8-
* This application demonstrates using FullBodyTrackerPico (XR_BD_body_tracking) to read the
8+
* This application demonstrates using FullBodyTracker (XR_BD_body_tracking) to read the
99
* 24-joint body skeleton through DeviceIOSession. Requires a runtime with body tracking support
1010
* (e.g. CloudXR streaming from a PICO 4 Ultra Enterprise with Motion Trackers); when the system
1111
* does not support body tracking the tracker runs in limp mode and no samples are printed.
@@ -19,7 +19,7 @@
1919
#include "common_utils.hpp"
2020

2121
#include <deviceio_session/deviceio_session.hpp>
22-
#include <deviceio_trackers/full_body_tracker_pico.hpp>
22+
#include <deviceio_trackers/full_body_tracker.hpp>
2323
#include <oxr/oxr_session.hpp>
2424
#include <schema/full_body_generated.h>
2525

@@ -36,12 +36,12 @@ using namespace schemaio_example;
3636
namespace
3737
{
3838

39-
void print_body_pose(const core::FullBodyPosePicoT& data, size_t sample_count)
39+
void print_body_pose(const core::FullBodyPoseT& data, size_t sample_count)
4040
{
4141
const auto& joints = *data.joints->joints();
4242

4343
uint32_t valid_count = 0;
44-
for (uint32_t i = 0; i < core::FullBodyTrackerPico::JOINT_COUNT; ++i)
44+
for (uint32_t i = 0; i < core::FullBodyTracker::JOINT_COUNT; ++i)
4545
{
4646
if (joints[i]->is_valid())
4747
{
@@ -51,11 +51,11 @@ void print_body_pose(const core::FullBodyPosePicoT& data, size_t sample_count)
5151

5252
// Joint poses are unspecified while their tracking is lost — gate on is_valid per joint
5353
// (all_joint_poses_tracked is a whole-skeleton quality flag only).
54-
const auto& pelvis = joints[core::BodyJointPico_PELVIS]->pose().position();
55-
const auto& head = joints[core::BodyJointPico_HEAD]->pose().position();
54+
const auto& pelvis = joints[core::BodyJoint_PELVIS]->pose().position();
55+
const auto& head = joints[core::BodyJoint_HEAD]->pose().position();
5656

5757
std::cout << "Sample " << sample_count << std::fixed << std::setprecision(3) << " valid=" << valid_count << "/"
58-
<< core::FullBodyTrackerPico::JOINT_COUNT << " pelvis=[" << pelvis.x() << ", " << pelvis.y() << ", "
58+
<< core::FullBodyTracker::JOINT_COUNT << " pelvis=[" << pelvis.x() << ", " << pelvis.y() << ", "
5959
<< pelvis.z() << "] head=[" << head.x() << ", " << head.y() << ", " << head.z() << "]" << std::endl;
6060
}
6161

@@ -67,8 +67,8 @@ try
6767
std::cout << "Full Body Printer (XR_BD_body_tracking)" << std::endl;
6868

6969
// Step 1: Create the tracker
70-
std::cout << "[Step 1] Creating FullBodyTrackerPico..." << std::endl;
71-
auto tracker = std::make_shared<core::FullBodyTrackerPico>();
70+
std::cout << "[Step 1] Creating FullBodyTracker..." << std::endl;
71+
auto tracker = std::make_shared<core::FullBodyTracker>();
7272

7373
// Step 2: Get required extensions and create OpenXR session
7474
std::cout << "[Step 2] Creating OpenXR session with required extensions..." << std::endl;

0 commit comments

Comments
 (0)