ami-iit / yarp-openvr-trackers

This repo contains an application to stream VIVE trackers pose in yarp using OpenVR
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Check the software usage to get the pose of the trackers without the headsets #11

Open HosameldinMohamed opened 2 years ago

HosameldinMohamed commented 2 years ago

Following https://github.com/ami-iit/yarp-openvr-trackers/issues/10, we are able use openVR to obtain the trackers poses without the headset. However, the current version of the software (https://github.com/ami-iit/yarp-openvr-trackers/releases/tag/v0.0.1), doesn't support it yet.

In this issue, we highlight the difference in behavior when eliminating the headset.

In detail, following #10, then launching

yarpdev --device transformServer --ROS::enable_ros_publisher 0 --ROS::enable_ros_subscriber 0

then

yarp-openvr-trackers

Streams these error messages

[ERROR] The state of the output of device LHR-87B324E3 is not ok

Which seems to be coming from https://github.com/ami-iit/yarp-openvr-trackers/blob/cd153dbb2c9a6c5056cf13bd74865c7b14850f1a/src/OpenVRTrackersDriver.cpp#L317-L322

HosameldinMohamed commented 2 years ago

Some observations

[INFO] The device xxxxxx has unsupported type

Which seems to be coming from https://github.com/ami-iit/yarp-openvr-trackers/blob/cd153dbb2c9a6c5056cf13bd74865c7b14850f1a/src/OpenVRTrackersDriver.cpp#L203-L206

But it seems only a warning.

HosameldinMohamed commented 2 years ago

Replacing https://github.com/ami-iit/yarp-openvr-trackers/blob/cd153dbb2c9a6c5056cf13bd74865c7b14850f1a/src/OpenVRTrackersDriver.cpp#L309-L314 With

vr::TrackedDevicePose_t poses[pImpl->devices.size()];
pImpl->vr->GetDeviceToAbsoluteTrackingPose(vr::ETrackingUniverseOrigin(pImpl->origin), 0, &poses[0], pImpl->devices.size());
pose = poses[pImpl->devices[serialNumber].index];

Seems to do the trick! The behavior is as expected. The trackers' poses are streamed via the transform server, and The checks are not throwing warnings.

However the method is a bit different from the previous one because it expects an array of vr::TrackedDevicePose_t.

We need to review it because it throws a segfault when a tracker is switched off for example. There should be a better way to access it!

HosameldinMohamed commented 2 years ago

After the modification in #12, the device can work without the headset, but I had to change the line https://github.com/ami-iit/yarp-openvr-trackers/blob/e6694adeb30d18f279fabd06fd867d76b44b3415/src/OpenVRTrackersDriver.h#L59-L60 From Seated to Standing. Not sure if updating it upstream will affect other use cases.