YARP OpenVR Trackers project allows to stream OpenVR based tracker poses over a YARP Frame Transform Server.
The installation and usage procedure was tested with Windows 10 OS.
If you do not already have Visual Studio installed on your machine, you can install it using the Visual Studio Installer by enabling Desktop and Mobile C++ development package.
This can be enabled by clicking on the Modify
button in the installer corresponding to the desired installation.
- Install Steam
- After installation, either create a Steam account or use an existing one to log-in and install SteamVR.
We rely on YARP for the use of yarp-openvr-trackers. If YARP
is not already installed on your Windows machine, we recommend to install YARP
using robotology-superbuild.
robotology-superbuild
can be installed either from source or using binaries with its dependencies installed using Package environment system called Conda following the installation procedure here. Subsequently, robotology-superbuild can be installed from source or using binaries by following the installation procedure here.
While following the installation procedure using Conda-forge based dependencies, you create an environment within which the packages are installed.
So everytime, we open a new terminal we need to activate this environment in order to access the installed dependencies and installed packages from the robotology-superbuild
.
Note that, if you have followed a Source-based installation in installation procedure here, your environment needs to be activated using,
mamba activate robsub
while, if you have followed the binary installation procedure in installation procedure here, you have to use,
mamba activate robotologyenv
Note that this may not apply if you have installed YARP
or robotology-superbuild
following any other custom installation procedures.
Install git
and PkgConfig
.
mamba install -c conda-forge git pkg-config
We install OpenVR using a custom fork from ami-iit organization because of some custom patches from the original repository.
We clone, build, and install the repository from fix_upstream
branch (which is the default branch of the fork).
git clone -b fix_upstream https://github.com/ami-iit/openvr
cd openvr
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX:PATH=<full-absolute-path-to-where-you-want-to-install-openvr> -DBUILD_SHARED=ON ..
cmake --build . --config Release
cmake --install . --config Release
Visual Studio 17 2022
applies for a Visual Studio 2022 Installation. Previous versions of installation should use corresponding tags, such as Visual Studio 16 2019
for a 2019 installation
NOTE: The CMake option BUILD_SHARED
needs to be set to ON
on Windows, while on Linux/macOS it can be left to be OFF
.
NOTE: Since we are using the conda environment for installation, a common trick to avoid having to set new environment variables is just to install the CMake project directly in the environment, i.e. passing -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
on Linux/macOS or -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library
on Windows.
To have OpenVR installation to be identified by CMake, we need to add it to the package configuration path.
This can be done from the terminal after activating the mamba
environment by,
set PKG_CONFIG_PATH=%PKG_CONFIG_PATH%;<path_to_openvr-install-location>/share/pkgconfig
To verify if the package is properly added to the path, we may run
pkg-config --list-all
and check for openvr
in the list of packages displayed.
We install yarp-openvr-trackers
git clone https://github.com/ami-iit/yarp-openvr-trackers.git
cd yarp-openvr-trackers
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX:PATH=<full-absolute-path-to-where-you-want-to-install-yarp-openvr-trackers> ..
cmake --build . --config Release
cmake --install . --config Release
In order to properly use YARP across the network, we have to provide firewall access to the YARP executables. To do this,
- Go to Control Panel -> System and Security -> Windows Defender Firewall -> Allowed apps
- You must be on
Firewall and network protection
page in theWindows Security
section. Click onAllow an app through firewall
- Click on
Change settings
to have administrator privilege. - Scroll down to find
yarp.exe
in the list and selectDetails...->Network types...
and check all the network types (Domain
,Public
, andPrivate
) and clickOk
. - Then we may have to repeat the procedure for
yarpdev
,yarp-server
, andyarp-openvr-trackers
usingAllow another app...
button.
- Place the base stations in desired locations and power them on.
- Connect the Vive headset to the PC. (At this moment, connecting a headset is required to use SteamVR, in the future we need to find a workaround to avoid connecting the headset). It must be noted that the trackers pose are obtained relative to the Vive headset.
- Ensure that PC connecting the headset is not connected to an external display/monitor. Otherwise, the display is extended into the headset and is not identified by SteamVR. With only the headset connected to the PC, ensure that the displays are extended (Display settings -> Extend the displays).
- Now, SteamVR should identify the base station and the headset.
- Once the headset is properly identified, it prompts you to update Bluetooth driver settings and enable direct display mode. Follow the procedures.
- The settings for the headset will be displayed. Go to Settings->General and disable SteamVR home.
- We then have to follow a calibration procedure indicated by SteamVR to set the seated position and floor position.
- In order to see what the user views through the headset, click on the menu button on SteamVR app and select Display VR View.
- In order to pair the Vive trackers, select Menu->Devices->Pair Controllers and select the Vive tracker to follow the pairing procedure.
- If the trackers are properly paired, you must see them through the headset.
Now, in order to obtain the pose of the trackers through the YARP network, we will run the following commands.
- Run
yarpserver
in a newmamba
activated terminal. - Run
transformServer
in a newmamba
activated terminal,
yarpdev --device transformServer --ROS::enable_ros_publisher 0 --ROS::enable_ros_subscriber 0
- Run
yarp-openvr-trackers
yarp-openvr-trackers
To verify the transforms are being published,
yarp read ... /transformServer/transforms:o
This must display the name of the headset and the marker name along with the poses in quaternion and position format.
You can pass the "Tracking universe" as a parameter to yarp-openvr-trackers
by running the executable with the option --vrOrigin
. For example:
yarp-openvr-trackers --vrOrigin standing
The value standing
can be chagnged to seated
or raw
, and it's case insensitive. The default origin seated
will be used when no parameter is passed or when passing an invalid value.
From SteamVR, it is possible to assign a "role" to a tracker via the "Manage Trackers" menu.
HELD IN HAND
role, the tracker orientation appears to be different with respect to all the other roles.
Tracker roles | Orientation |
---|---|
In the images above, the trackers were positioned as follows: