Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HosameldinMohamed opened this issue May 26, 2022 · 3 comments

Comments

@HosameldinMohamed
Copy link
Contributor

Following #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

if (pose.eTrackingResult
!= vr::ETrackingResult::TrackingResult_Running_OK) {
yError() << "The state of the output of device" << serialNumber
<< "is not ok";
return std::nullopt;
}

@HosameldinMohamed
Copy link
Contributor Author

Some observations

  • When we launch yarp-openvr-trackers it detects a device called /hmd/Null Serial Number, which seems to be the dummy driver we enable to bypass the headset. It also detects the trackers when they are connected.
  • The identified tracker is considered of the unsupported type, seeing this message
[INFO] The device xxxxxx has unsupported type

Which seems to be coming from

if (!Impl::DeviceTypeIsSupported(type)) {
yInfo() << "The device" << serialNumber << "has unsupported type";
return true;
}

But it seems only a warning.

@HosameldinMohamed
Copy link
Contributor Author

Replacing

pImpl->vr->GetControllerStateWithPose(
vr::ETrackingUniverseOrigin(pImpl->origin),
pImpl->devices[serialNumber].index,
&state,
sizeof(state),
&pose);
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
Copy link
Contributor Author

After the modification in #12, the device can work without the headset, but I had to change the line

DevicesManager(
const TrackingUniverseOrigin origin = TrackingUniverseOrigin::Seated);

From Seated to Standing. Not sure if updating it upstream will affect other use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant