rvt / headtracker

Head Tracker using MPU6050/MPU9250 and ESP8266
BSD 3-Clause "New" or "Revised" License
34 stars 10 forks source link

shows MPU-9250 connected.. but no YPR info showing #1

Open Bacon8tor opened 4 years ago

Bacon8tor commented 4 years ago

I have uploaded the sketch, and connected to wifi, accessing the setup pages. Under tracker yaw , pitch and roll all show 0degrees. When I click calibrate the webpage says "Unknown error" but the Serial Monitor goes through the calibration, leaving on flat surface then waving in figure 8. I am using a Wemos d1 r1 mini https://miro.medium.com/max/2576/1*YKc8KpAfMrlhrOLmNjdRwQ.png and mpu 9250 pins are wired as such wemos ----- mpu9250 GND ---- GND 3.3v --- VCC D1 ---- SCL D2 --- SDA

I wasnt sure if the INT pin was needed but doesnt look like it. I also tried opening up opentrack but still there no data looks like it was being sent as it stayed at 0 for all YPR. I couldnt find a good place to try and debug and possible Serial print the data from the mpu.

Appreciate any help, this project is exactly what i started to try and do myself, but came across this and was way more put together than what I had. here are a few pictures of the webpage https://i.imgur.com/QK052Dx.png https://i.imgur.com/8nK548w.png here is the serial monitor output.

*WM: [2] Connection result: WL_CONNECTED

*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] AutoConnect: SUCCESS
*WM: [1] STA IP Address: 10.10.11.234
connected...yeey :)
*WM: [1] Starting Web Portal
*WM: [3] dns server started with ip: 
*WM: [2] HTTP server started
*WM: [2] WiFi Scan completed in 2194 ms
mounted file system
reading config file
opened config file
{
  "tracker_server": "10.10.10.165",
  "tracker_port": "5555",
  "tracker_protocol": "freepie",
  "mpu9250": {
    "AB0": -0.112976,
    "AB1": -0.224731,
    "AB2": -0.070923,
    "GB0": -1.427481,
    "GB1": 1.961832,
    "GB2": 2.908397,
    "MB0": -257.3269,
    "MB1": 143.7481,
    "MB2": 187.0547,
    "MS0": 1.001961,
    "MS1": 0.887153,
    "MS2": 1.143177
  },
  "zero": {
    "yaw": 0,
    "pitch": 0,
    "roll": 0,
    "x": 0,
    "y": 0,
    "z": 0
  }
}has tracker location
Initializing MPU9250...
Scanning...
I2C device found at address 0x68  !
done

MPU9250 9-axis motion sensor...
MPU9250 is online...
x-axis self test: acceleration trim within : 1.0% of factory value
y-axis self test: acceleration trim within : 1.1% of factory value
z-axis self test: acceleration trim within : 1.6% of factory value
x-axis self test: gyration trim within : 8.7% of factory value
y-axis self test: gyration trim within : 11.1% of factory value
z-axis self test: gyration trim within : 1.0% of factory value
Using saved calibration.
MPU9250 initialized for active data mode....
AK8963 I AM 48 I should be 48
AK8963 initialized for active data mode....
DMP Ready!*WM: [2] <- HTTP Root
*WM: [3] -> 10.10.11.234
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [2] WiFi Scan completed in 2195 ms
*WM: [2] <- HTTP Param 
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [3] Sent param page 
About to start calibrating gyro and accelerator, keep device flat and still!!!
Starting....
Finnished in 0.4 seconds
About to start calibrating magnetic compass, Wave device in a figure eight until done!
Starting....
Mag Calibration: Wave device in a figure eight until done!
Mag Calibration done!
Finnished in 22.5 seconds
saving config

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 3656, room 16 
tail 8
chksum 0x0c
csum 0x0c
v9c56ed1f
~ld

 Starting
*WM: [3] allocating params bytes: 20
*WM: [2] Added Parameter:
*WM: [2] Added Parameter: track_server
*WM: [2] Added Parameter: track_port
*WM: [2] Added Parameter: track_protocol
*WM: [2] Added Parameter:
*WM: [1] <form action='/wifi'    method='get'><button>Configure WiFi</button></form><br/>
<form action='/0wifi'   method='get'><button>Configure WiFi (No Scan)</button></form><br/>
<form action='/info'    method='get'><button>Info</button></form><br/>
<form action='/param'   method='get'><button>Setup</button></form><br/>
<hr><br/><form action='/erase'   method='get'><button class='D'>Erase</button></form><br/>
<form action='/restart' method='get'><button>Restart</button></form><br/>

*WM: [1] AutoConnect
*WM: [2] esp_wifi_set_country: US
*WM: [2] Connecting as wifi client...
*WM: [3] STA static IP:
*WM: [2] setSTAConfig static ip not set, skipping
*WM: [1] Connecting to SAVED AP: OHS_WiFi
*WM: [3] Using Password: 0rangut@n
*WM: [3] WiFi station enable
*WM: [3] enableSTA PERSISTENT ON
*WM: [1] connectTimeout not set, ESP waitForConnectResult...
*WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] AutoConnect: SUCCESS
*WM: [1] STA IP Address: 10.10.11.234
connected...yeey :)
*WM: [1] Starting Web Portal
*WM: [3] dns server started with ip: 
*WM: [2] HTTP server started
*WM: [2] WiFi Scan completed in 2193 ms
mounted file system
reading config file
opened config file
{
  "tracker_server": "10.10.10.165",
  "tracker_port": "5555",
  "tracker_protocol": "freepie",
  "mpu9250": {
    "AB0": -1.142944,
    "AB1": -0.092163,
    "AB2": -0.892395,
    "GB0": 0.099237,
    "GB1": 0.717557,
    "GB2": 1.229008,
    "MB0": 21.29602,
    "MB1": 944.123,
    "MB2": 125.2752,
    "MS0": 1.102136,
    "MS1": 0.621141,
    "MS2": 2.071553
  },
  "zero": {
    "yaw": 0,
    "pitch": 0,
    "roll": 0,
    "x": 0,
    "y": 0,
    "z": 0
  }
}has tracker location
Initializing MPU9250...
Scanning...
I2C device found at address 0x0C  !
I2C device found at address 0x68  !
done

MPU9250 9-axis motion sensor...
MPU9250 is online...
x-axis self test: acceleration trim within : 1.9% of factory value
y-axis self test: acceleration trim within : 0.3% of factory value
z-axis self test: acceleration trim within : 1.2% of factory value
x-axis self test: gyration trim within : 8.6% of factory value
y-axis self test: gyration trim within : 11.2% of factory value
z-axis self test: gyration trim within : 0.7% of factory value
Using saved calibration.
MPU9250 initialized for active data mode....
AK8963 I AM 48 I should be 48
AK8963 initialized for active data mode....
DMP Ready!
Bacon8tor commented 4 years ago

well after just going thru the code line by line, backtracing. The interrupt pin should be connect. and now it is showing the YPR values. but Hitting calibrate still shows unknown error on webpage, and in serial monitor finishes in .4 seconds About to start calibrating gyro and accelerator, keep device flat and still!!! Starting.... Finnished in 0.4 seconds which doesnt seem right to me, the mag calibration runs for 22 seconds. after I run those I zero out looking at the screen. Once I have it connected to Opentrack, it connects and pushes data, pitch and roll seem good, but yaw doesnt. If I turn to the left the tracker turns to the left but then quickly goes back to center without me moving my head back to center. and looking at the webpage, yaw will move to -51deg, then quickly to -8deg without me moving.
I suspect the accel and gyro calibration are not running. Although I dont know why, I have tried several times and it deosnt seem to be updating and I assume this is why the self test shows values and they dont change cause its using the default ones stored.

Again if possible would love a litle help or point in something I can try to do. maybe even run a calibration then be able to plug the numbers into the code, to be able to test it if fixes the issue

rvt commented 4 years ago

Hey,

I never could get the MPU9250 working really well and I think there is something wonky on the library I used . I always head getter result with the 6050, but that one always start to drift away. The 6050 does have internal quaternionFilters that seems to be better...

Note: When doing the figure 8, it's lik s roller coaster figure 8. The, do move it up-side-down. Essentially the device need to be pointed in all directions... Just to be clear :)

The interupt pin indeed should be connected : See https://github.com/rvt/headtracker/blob/master/src/main.cpp top few lines

The very quick calibration when laying still is 'correct', however I noticed that the 6050 takes a much longer time and generally feels more stable.

All-in-all I could never get this head tracking itself to work rock stable.. Always some drift or some oddity when playing for a longer period

Bacon8tor commented 4 years ago

Hey,

I never could get the MPU9250 working really well and I think there is something wonky on the library I used . I always head getter result with the 6050, but that one always start to drift away. The 6050 does have internal quaternionFilters that seems to be better...

Note: When doing the figure 8, it's lik s roller coaster figure 8. The, do move it up-side-down. Essentially the device need to be pointed in all directions... Just to be clear :)

The interupt pin indeed should be connected : See https://github.com/rvt/headtracker/blob/master/src/main.cpp top few lines

The very quick calibration when laying still is 'correct', however I noticed that the 6050 takes a much longer time and generally feels more stable.

All-in-all I could never get this head tracking itself to work rock stable.. Always some drift or some oddity when playing for a longer period

Thanks for replying, yea I did find that line for the interrupt. I have been using the 6050, and have he same experience with drift. it works fairly well but the drift creeps so have to recenter it while playing. Thats why I tried the 9250 because the mag suppose to help with that, but i am having the same problems with the libraries, and just in general getting it to work.

I had a thought about trying to use them both a 6050 and 9250 but that see counter-intuitive since the 9250 should be a 6050 plus a mag, but doesn't seem that way.

The instant recentering Im getting with this project seems really weird, its not like the normal drift its almost instant I turn the device and once I stop its instantly moving back to center. Not sure whats causing that. But holding it in one spot seems fairly stable , the 6050 for me starts to drift quite a bit, and havent been able to find a good sketch that can somehow compensate for it.

Wireless head tracking has been a game changer tho, even given the struggle. I love not having a wire and all and all im still in this way less than a trackIr system.