Giter VIP home page Giter VIP logo

openvr-arduinohmd's Introduction

EN RU ← Choose language | Выберите язык

OpenVR Arduino HMD

Driver for OpenVR / SteamVR, which allows to track the head, using any Arduino rotation tracker, for a DIY VR HMD from HDMI display and headset.

Setup

  1. Connect the second VR display and set the extended mode in the monitor settings.
  2. Install SteamVR.
  3. Unpack the driver to a folder "...\Steam\steamapps\common\SteamVR\drivers". Configure the necessary parameters (windowX, windowY, windowWidth, windowHeight and others), in the configuration file "...\Steam\steamapps\common\SteamVR\drivers\arduinohmd\resources\settings\default.vrsettings".
  4. Launch SteamVR and in the SteamVR status window click -> Room Settings -> Small Room -> Calibration -> 170 cm. The SteamVR demo can be closed, and the launch of SteamVR Home can be disabled in the SteamVR settings.
  5. Put on the HMD, if necessary, centering them with key (by default, Numpad 5 or CTRL + ALT + R, can change the key in the configuration file by typing the desired key name).

If you are using an Android smartphone, then it will probably be easier to use OpenTrack driver, there you can also read instructions about streaming images to your smartphone.

You can quick turn on and turn off the extended VR monitor of the HMD using the HMD Assistant utility or MultiMonitorTool.

Arduino & rotation trackers

To track the turns of the head, you will need to buy Arduino Nano and connect a board with rotation sensors to it, for example, MPU 6050 GY-521, MPU 9250, MPU 3200 GY-85 or any other if there is a firmware with the output of Yaw, Pitch, Roll values and calibration. The data output is binary (3 float values), an example can be viewed here.

There is a ready-made Arduino firmware for the MPU 3200 GY-85, it is called Razor AHRS. Along with it comes a program for calibration and demonstration. After calibration, replace the file "Output.ino", in the firmware folder, with this. It is important to note here that there are new revisions of GY-85 that are incompatible with this firmware. The following sensors are supported by the firmware: the ADXL345 accelerometer, the ITG-3200 gyroscope and the HMC5843, HMC5883L magnetometers. The calibration instructions can be found on youtube.

There is a ready-made Arduino firmware for MPU 6050 GY-521. It is necessary to solder according to the scheme, download libraries, unpack them into the "libraries" folder of the Arduino IDE. Put the tracker on a flat surface, flash the sketch "MPU6050_calibration.ino" and get the data for calibration. Next, you need to flash the sketch "HMD_MPU6050_DMP6.ino", by entering the calibration data already received into it.

The speed should be changed to 115200 if a different one is set by default.

Configuration file options

Name Description
COMPort The number of the Arduino COM port can be found in the Devices Manager. Use ports from 1 to 9, change it in the device properties if necessary.
CenteringKey The code of the picture centering key, you can change the key in the configuration file by typing the desired name code).
CrouchPressKey The code of the crouch key, you can change the key in the configuration file by typing the desired name code). It is necessary for communication with other drivers, for example, using Razer Hydra controllers and using this driver you can crouch.
CrouchOffset The height of the crouch at the press of a button.
DistanceBetweenEyes The distance between stereo images, the larger the closer.
DistortionK1, DistortionK2 Lens distortion factors.
ScreenOffsetX Horizontal image shift.
ZoomHeight, ZoomWidth Scaling factors of stereo images.
FOV Degree of field of view. You can zoom in, depending on the VR headset lenses.
displayFrequency Screen refresh rate.
renderWidth, renderHeight Image rendering resolution for one eye.
windowWidth, windowHeight Height and width of the displayed window.
windowX, windowY Window offset is required for display on other monitors. For example, to display on the second display, which is displayed on the right, you need to specify the value 1920 (provided that the first display has a resolution of 1920 by 1080). The exact data can be viewed using the MultiMonitorTool utility, and also with it you can turn off and turn on the second monitor via a bat file.
DebugMode Debug mode, locked at 30 FPS. After checking, it is recommended to set it to false (disable).
ArduinoRequire Requires a connected Arduino to start the driver. The parameter is necessary for quick tests of controllers, so as not to connect and put on a hmd for tests. To disable, change to false.

Hotkeys

Name Description
Numpad 5, CTRL + ALT + R Centering the picture.
Page Up, Page Down Rise or decline.
Numpad 8, 2, 4, 6 Move forward, backward, left, right.
Numpad 1, 3 Change yaw.
Numpad 7, 9 Change roll.
Numpad - Resetting movements and lifting.

Known Issues

  1. Red screen. You can fix this by selecting the "Headset Window" window.

Download

Version for x86 и x64.
Download

Feedback

r57zone[at]gmail.com

openvr-arduinohmd's People

Contributors

r57zone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

openvr-arduinohmd's Issues

STM32 Version

Hi, I have a question regarding this project. I am trying to adapt your code for Arduino to be used on an STM32 (STM32H750XB) board with MPU6050.

Will this driver work as long as the STM32 board is communicating through USB COM with a baud rate of 115200? As I am writing my own code to transmit the signal to the PC, what should be the output from the STM32 to the PC?

Incorrect pitch and roll during head rotation

Hello and thanks for developing this driver!
Let me describe my problem.
I am using a homemade Arduino-based HMD device and I am faced with the problem of tracking head tilts to the right and left. The problem is incorrect display of head rotation during head rotation inside SteamVR Home (driver version 1.3 and SteamVR Version 1.24.7).
According to the results of the sketch, it looks good in symbolic form.
image
And translated into binary form
image
In SteamVR Home, while I'm standing in front of the screen, head tilts to the left and right are tracked correctly.
image
And the chin tilts also look correct
image
But if you turn your head to the right or left (yaw), and then tilt your head to the right (roll) looks like lowering your chin down (we have pitch instead of roll).
image
If you turn your head to the left, the same situation is observed. Tilting the head to the left becomes lowering the chin.
image
Turning the head back causes an inversion of the tilt of the head. For example, if the head is tilted to the right, the result is also a tilt, but only in the opposite direction.
image
It looks as if the coordinate system of head declaration does not rotate with HMD by yaw coordinate.
Please comment have you had any similar problems? And what could be the problem in your opinion?

Help...: Head Tracking by USB HID or COM_PORT (MOD FOV HMD 90º @ 135º FOV)

Hello r57zone, I want to thank you for all the content you have about OpenVR, I am using your drivers to be able to use my modified viewer @ 135ºFOV, you can see the MOD from this website.

https://www.realovirtual.com/foro/topic/51245/mod-visor-vr-los-90o-fov-135o-fov-anonymous-vr

I had the challenge of rotating the screens in SteamVR, after doing the MOD my tilted screens projected the crossed images, "as if cross-eyed".

I have used its controller and with the "GetProjectionRaw" function, I have managed to modify the images of the screens independently for each eye.

The viewer that I am using has a 3DOF IMU per USB HID port, it sends up to 32 data in 8 bits with values ​​from 0 to 255.

I don't have enough knowledge to create a USB HID connection with your controller, maybe you can help me on this, you have programming experience.

I'm also thinking of using its COM_PORT connection to the Arduino and sending the data from the USB HID.

How are you sending the data from the Arduino through the COM_PORT?

Can you give me an example of the data and its order of sending to the driver? I understand that you send 3 data from the IMU, I have up to 32 to send, but really many are for the accelerometers, but if I have up to 10 different data that I can use for head movements, some data is in degrees and other data is raw, the IMU controller, it gives different data for the same movement.

Capturadata

Thanks for your attention.

SteamVR closes at startup

I use DIY Arduino headtracker that produces the following data at 115200 BaudRate.

 float mypr[3] = {0, 0, 0}; //yaw, pitch, roll                 
            mypr[0] = ypr[0] * 180/M_PI;
            mypr[1] = ypr[1] * 180/M_PI;
            mypr[2] = ypr[2] * 180/M_PI;
           
            Serial.write((byte*) mypr, sizeof(mypr)); 

I've copied "arduinohmd" folder to SteamVR drivers folder, set COM port number in "arduinohmd" settings file. Then I've connected tracker via USB 2.0 and open SteamVR

SteamVR freezes and closes on startup every time.

The message from Windows Application log (I use OS Windows 10 ver. 20H2, OS build 19042.):

Faulting application name: vrstartup.exe, version: 1.18.7.0, time stamp: 0x60e61656
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x82dc99a2
Exception code: 0xc0000409
Fault offset: 0x0009eddb
Faulting process id: 0x30a0
Faulting application start time: 0x01d783c1476f445d
Faulting application path: C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin\win32\vrstartup.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report Id: 36913a40-0d5f-4d17-be45-d42ebb7f07fc
Faulting package full name:
Faulting package-relative application ID:

My steamvr.vrsettings file is

{
   "DesktopUI" : {
      "pairing" : "568,271,800,600,0",
      "settings_desktop" : "624,432,800,600,0"
   },
   "dashboard" : {
      "enableDashboard" : false
   },
   "steamvr" : {
      "activateMultipleDrivers" : true,
      "allowAsyncReprojection" : false,
      "directMode" : false,
      "enableHomeApp" : false,
      "installID" : "13246197459664423944",
      "lastVersionNotice" : "1.18.7",
      "lastVersionNoticeDate" : "1626220647",
      "showMirrorView" : false,
      "startMonitorFromAppLaunch" : false
   }
}

Without connecting Arduino, SteamVR starts normally

SteamVR version:

Built Jul 8, 2021 at 07:05
Version 1.18.7 (1625702712)

"Distance Between Eyes" function problems

I am trying to use your controller, when I use the "DistanceBetweenEyes" function from the default.vrsettings file, I get a cropped image with black sides.

Also the right image is inside the left image, you can get to see it from the right viewfinder lens.

How can we fix this problem, thanks

DistanceBetweenEyes 65

Is there a way to test the tracking in SteamVR without an HMD?

First of all thank you for this cool project, it looks very promising!

I already have the working headtracker with the Razor firmware and modified Output.ino file (as per your tutorial), but sadly I do not have any MIPI display yet.

SteamVR won't let setup and run the VR scene without an HMD attached, so I tried to use the null driver and "allowMultipleDrivers" in steamvr.vrsettings to launch the scene without a physical HMD, but looks like your driver is not being loaded if there is no physical display active (i.e. Arduino LEDs are not flashing as when COM port connection establishes, as well as I can connect to this COM port with another program, meaning it is not actively used).

Any other settings (like setting the COM port etc) are done per tutorial as well, so should be good to go.

Did you have any experience with settings this up without a real HMD? A friend of mine says he can borrow me a real helmet to test this, but I guess it will just use it's internal headtracker and drivers which will not work either. The null driver solution looks promising, but strangely the driver is not activated (though I can see it's being loaded in log files and debug console).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.