michael-betz / Foculus_Rift_Tracker_STM32F3DISCOVERY

Firmware for the STM32F3DISCOVERY board to emulate an Oculus Rift compatible USB motion tracker
62 stars 28 forks source link

Request - Configurable Orientations #2

Closed mungewell closed 10 years ago

mungewell commented 10 years ago

At present the Foculus outputs it's data so that it is held vertically, USB sockets down and LED's toward user.

I think the more common orientations would be:

Would it be possible to have control so that the orientation can be changed between the 6(?) 'standard' rotations? This should only involve picking the appropriate accelerometer/etc data to fill the USB packets.

These could be selected with the button, in a manner similar to gyro calibration. Does the STM32 include any EEPROM registers for long term storage?

michael-betz commented 10 years ago

Excellent idea!

Switching between the 6 orientation is in fact quite easy to implement with a big switch() statement. This would have to be inserted in main.c, in packFoculusdataBlock()

What I'm still a bit puzzled about is the "user interface". We got one button and 8 LEDs to work with.

So probably I would do it like this:

Also I think we actually have 48 possible orientations? Each X,Y and Z coordinate can be inverted (giving 8 possibilities) and the coordinates can be swapped with each other (giving 6 possibilities).

So I think I will just try to pick a few orientations which might be useful.

Cheers YFL

michael-betz commented 10 years ago

I just implemented that feature. Please have a look. Cheers YFL

mungewell commented 10 years ago

I downloaded the HEX and can confirm that it works. Tested against Oculus World demo on Windows.

Calibration mode: Short press/release, all LEDs flash. Then single Blue, Red, Orange LEDs. Completes automatically and returns to cycling LEDs.

Mode Select: Long press, all LEDs off and then single LED showing mode. Short presses cycle mode. Long press stores mode, flashing single LEDs and then cycling LEDs.

Mode 1 (Red_: LEDs toward user, USB down Mode 2 (Blue): LEDs toward user, USB up Mode 3 (Orange): LEDs away from user, USB down Mode 4 (Green): LEDs away from user, USD up Mode 5 (Green): LEDs up, USB toward user Mode 6 (Orange): LEDs up, USB away from user. Mode 7 (Blue): LEDs up, USB to users right Mode 8 (Red): LEDs up, USB to user right

Unfortunately I don't think that this covers the most 'sensible' configuration of the Foculus, ie. mounted on the rear of the eye piece/display with the LEDs facing away from the user (so that the button can be pushed) and the USB to either the right or left.

I'd also think that anyone making a headset would probably cut all the headers off to allow smallest mounting configuration, and sticking board and display together.

Cheers, Simon.

michael-betz commented 10 years ago

Hi,

I put the relevant orientation in the second slot. I also updated the Readme file with a table of all the possible orientations. Cheers for figuring it out.

YFL

mungewell commented 10 years ago

Excellent, yes it works as expected: Mode 2 (Blue): LEDs away from user, USB to user's right.

Thanks for doing this, I have way to many projects on the go to have time to learn a new compiler.