Board index FlightGear Support Interfacing

Head Tracking

Connecting two computers, using generic protocol, connecting with Matlab?

Head Tracking

Postby tripstar76 » Sun Oct 07, 2018 2:52 pm

Getting somewhere with arduino GY-85 head tracking.

No need for middleman software. Just arduino - serial - protocol

Flightgear 2018.2.2
Linux Mint 18.3
CPU~Quad core Intel Core i7-2670QM (-HT-MCP-) 3100 MHz
Kernel~4.10.0-38-generic x86_64
Mem~7891.0MB
NVIDIA Corporation
4.5.0 NVIDIA 384.130
GeForce GT 540M/PCIe/SSE2
tripstar76
 
Posts: 8
Joined: Sun Aug 19, 2018 10:24 am
Location: United Kingdom, Selby
Version: 2018.2.2
OS: Linux Mint 18.3

Re: Head Tracking

Postby wlbragg » Sun Oct 07, 2018 5:05 pm

Nice!

Any plans to share code and parts list? :smile:
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Head Tracking

Postby tripstar76 » Sun Oct 07, 2018 8:40 pm

You need Arduino 1.8.5. Won't compile on 1.8.6+ :
https://www.arduino.cc/en/Main/OldSoftwareReleases#previous
and Processing:
https://processing.org/download/

Download the Arduino, Processing and FlightGear stuff:
https://drive.google.com/open?id=1vGmut5aurmqkNbegiB1BxLaZeMRT_B7q

Razor_AHRS folder goes in to Arduino sketchbook folder
Magnetometer and Razor_Test folders go in - processing/Sketchbook/ folder
EJML folder goes in - processing/Sketchbook/libraries/ folder
headtrack.xml and put in fgdata/Protocol folder

You need An Arduino and a GY-85 IMU(pennies from the bay)

Wireing for arduino UNO:
GY-85 -> Arduino
--------------------
VCC_IN -> 5V
GND -> GND
SCL -> SCL
SDA -> SDA


Upload the Razor_AHRS sketch to the Arduino.

Then use the Instructs.PDF to get you through the rest
Flightgear 2018.2.2
Linux Mint 18.3
CPU~Quad core Intel Core i7-2670QM (-HT-MCP-) 3100 MHz
Kernel~4.10.0-38-generic x86_64
Mem~7891.0MB
NVIDIA Corporation
4.5.0 NVIDIA 384.130
GeForce GT 540M/PCIe/SSE2
tripstar76
 
Posts: 8
Joined: Sun Aug 19, 2018 10:24 am
Location: United Kingdom, Selby
Version: 2018.2.2
OS: Linux Mint 18.3

Re: Head Tracking

Postby tripstar76 » Sun Oct 07, 2018 9:55 pm

Oh, just thought a bit more info might be helpful. Obviously, this is very beta, I need to make a few more tweaks.

When you start FG and go fly, the GY85 has to be facing the right way, and has to be still to capture the first readings for the yaw offset. If the tracking starts to go a bit wonky, just reset the arduino with the GY85 in a centered position, and everything should pull true(although, I've not had it drift yet)

Once evrything is uploaded and calibrated, try my settings out with FG, they might just work straight off, but if not......
The bits of code that need to be tweaked to get the tracking playing right with FG are:
The Output.ino file, lines 25 & 26
Code: Select all
    }
    Serial.print(mapf((TO_DEG(yaw) - (offSet)), 100, -100, -180, 160)); Serial.print(",");  <<<<<<<<<
    Serial.print(mapf(TO_DEG(pitch), -45, 45, -30, 30)); Serial.print(",");                           <<<<<<<<<
    Serial.println();
  }
}


Make your changes, re upload and retest.

Oh, Don't forget - --generic=serial,in,30,/dev/ttyUSB0,9600,headtrack
Flightgear 2018.2.2
Linux Mint 18.3
CPU~Quad core Intel Core i7-2670QM (-HT-MCP-) 3100 MHz
Kernel~4.10.0-38-generic x86_64
Mem~7891.0MB
NVIDIA Corporation
4.5.0 NVIDIA 384.130
GeForce GT 540M/PCIe/SSE2
tripstar76
 
Posts: 8
Joined: Sun Aug 19, 2018 10:24 am
Location: United Kingdom, Selby
Version: 2018.2.2
OS: Linux Mint 18.3

Re: Head Tracking

Postby wlbragg » Mon Oct 08, 2018 12:41 am

Now I guess I have to go get the GY-85 IMU! I will report back when I have something. This is just the project I've been waiting for to cut my teeth on.

Wonderful, thank you.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Head Tracking

Postby tripstar76 » Mon Oct 08, 2018 8:01 pm

I've found a slight problem with this, which I am trying to figure out, but struggling.
The yaw is basically north at 0, east at 90, west at -90 and south is between -179.99 and 179.99.
I add a -90 offset to the yaw, as I face east to look at the computer screen. Which works. But, if you look nearly south to view your computer monitor, so try to add an -170ish offset, the scale gets to 179.99 and then craps out.
It's probably easier to try it for yourself. Reset the board at various compass angles and watch the serial read out.
If you face north to use see your computer screen, this thing is ideal!
Flightgear 2018.2.2
Linux Mint 18.3
CPU~Quad core Intel Core i7-2670QM (-HT-MCP-) 3100 MHz
Kernel~4.10.0-38-generic x86_64
Mem~7891.0MB
NVIDIA Corporation
4.5.0 NVIDIA 384.130
GeForce GT 540M/PCIe/SSE2
tripstar76
 
Posts: 8
Joined: Sun Aug 19, 2018 10:24 am
Location: United Kingdom, Selby
Version: 2018.2.2
OS: Linux Mint 18.3

Re: Head Tracking

Postby tripstar76 » Thu Oct 11, 2018 9:59 pm



It now sets view correctly whichever way you're facing.

Now I just need to add longer wires, attatch it to my head(staples will work, right?), and give it a test run.

Then... I'll get it wired and fitted to this bad boy...
Image
Flightgear 2018.2.2
Linux Mint 18.3
CPU~Quad core Intel Core i7-2670QM (-HT-MCP-) 3100 MHz
Kernel~4.10.0-38-generic x86_64
Mem~7891.0MB
NVIDIA Corporation
4.5.0 NVIDIA 384.130
GeForce GT 540M/PCIe/SSE2
tripstar76
 
Posts: 8
Joined: Sun Aug 19, 2018 10:24 am
Location: United Kingdom, Selby
Version: 2018.2.2
OS: Linux Mint 18.3


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 2 guests