rvt / headtracker Goto Github PK
View Code? Open in Web Editor NEWHead Tracker using MPU6050/MPU9250 and ESP8266
License: BSD 3-Clause "New" or "Revised" License
Head Tracker using MPU6050/MPU9250 and ESP8266
License: BSD 3-Clause "New" or "Revised" License
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!
main.cpp:112 result in
cannot bind non-const lvalue reference of type 'string&' to an rvalue of type 'string'
reference: https://arduinojson.org/v6/api/jsonvariant/as/
I tried for hours before I realized I should look hereπ
When I changed this line to "const char* tmp = json["tracker_server"].as<const char*>();" the problem was solved
I've made a similar headtracker before and found this much superior project only after doing so. I learned platformIO through this project while adapting my nodemcuv2, thanks to this project.
Also, generating html or js looks like it requires linux, which I found can now be generated and downloaded from Codespaces.
I'm using a translation program, so I apologize for the reading inconvenience!
calibration and zero do not work properly, the calibration problem can be solved inelegantly by changing the if in line 231 to always true. But "TRACK_PEEK_URI" always 0, so the zero button is useless.
change
if (hwTrack->isReady()) {
doCalibrate = true;
to
if (1) {
doCalibrate = true;
or something seems crash when hit calibrate button in browser.
Starting
*wm:AutoConnect
*wm:No wifi saved, skipping
*wm:AutoConnect: FAILED for 1 ms
*wm:StartAP with SSID: WM_AutoConnectAP
*wm:AP IP address: 192.168.4.1
*wm:Starting Web Portal
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Exception (28):
epc1=0x40205493 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffc30 end: 3fffffd0 offset: 0190
3ffffdc0: 4020f301 00000030 00000010 00000000
3ffffdd0: 0023002f 00000000 00000000 000f000f
3ffffde0: 00000000 00000000 00000000 fffffffe
3ffffdf0: 3fff29c4 3fff2b20 00000000 40212d58
3ffffe00: 3fff0fd8 00000000 00000000 00000000
3ffffe10: 3fff0fd8 3fff29c4 3fff2adc 40204fe1
3ffffe20: 00000000 3fff29c4 3fff296c 4020ce60
3ffffe30: 00000001 00000000 00000000 0023002f
3ffffe40: 00000000 00000000 3ffea4b4 3fff29a0
3ffffe50: 00000000 00006e44 00000000 00000001
3ffffe60: 3fff0fd8 3fff29a0 00000000 00000000
3ffffe70: 3fff0fd8 3fff29a0 3fff296c 4020f096
3ffffe80: 40220c14 00000000 00001388 40207322
3ffffe90: 3fff0fd8 3fff0fd8 3fff32d4 4021dc2b
3ffffea0: 3fff0fd8 00000000 402139be 00000000
3ffffeb0: 3fff0fd8 3fff0fd8 3fff0ed8 4020f301
3ffffec0: 00303231 3fffff0c 3fffff18 00000000
3ffffed0: 00000000 00000000 3ffea4b4 00000001
3ffffee0: 3fff0fd8 00000000 402139be 00000000
3ffffef0: 3fff0fd8 00000001 3fff0ed8 4020f721
3fffff00: 00000000 73646e6f 00000000 00000000
3fffff10: 000b000f 00000000 00000000 000b000f
3fffff20: 00000000 00000000 3fff0ed8 3fff0e84
3fffff30: 3ffea8de 00000000 00000001 4020b920
3fffff40: 00000000 00000000 00000000 3fff0e84
3fffff50: 3fff0e68 3fff133c 3fff0ed8 40204d82
3fffff60: 40201d54 3ffea6ed 4021fa10 4021fa08
3fffff70: 3ffea703 3ffea707 3ffea70d 3fff259c
3fffff80: 3fff25b8 3fff25b8 feefeffe feefeffe
3fffff90: 3fff25b8 00000000 feefeffe feefeffe
3fffffa0: feefeffe feefeffe feefeffe 3fff14c8
3fffffb0: 3fffdad0 00000000 3fff149c 40213b40
3fffffc0: feefeffe feefeffe 3fffdab0 4010126d
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00069120
~ld
Starting
*wm:AutoConnect
*wm:No wifi saved, skipping
*wm:AutoConnect: FAILED for 1 ms
*wm:StartAP with SSID: WM_AutoConnectAP
*wm:AP IP address: 192.168.4.1
*wm:Starting Web Portal
Hello, I'm still new to VSC and platformIO environment. I was trying to compile this code, but it seems I have hit a roadblock here.
Before this, I got an error due to https://github.com/tzapu/WiFiManager#development
but this problem is fixed by changing the URL. However, for this case I don't know what to do. Help will be appreciated :)
`> Executing task: C:\Users\skyguardian.platformio\penv\Scripts\platformio.exe run <
Processing wemos (platform: espressif8266; framework: arduino; board: esp01_1m)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html
PLATFORM: Espressif 8266 (3.2.0) > Espressif Generic ESP8266 ESP-01 1M
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES:
25 | #include "jscript.generated.h"
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\wemos\src\main.cpp.o] Error 1
=========================================================================== [FAILED] Took 6.52 seconds ===========================================================================
The terminal process "C:\Users\skyguardian.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
`
PS C:\Users\user\Desktop\headtracker-master> .\generateHtmlArray.sh
PS C:\Users\user\Desktop\headtracker-master> platformio run --target upload -e wemos
platformio : The term 'platformio' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ CategoryInfo : ObjectNotFound: (platformio:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\user\Desktop\headtracker-master>
PS C:\Users\user\Desktop\headtracker-master> platformio run --target upload -e wemos
platformio : The term 'platformio' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ CategoryInfo : ObjectNotFound: (platformio:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Hello! can you help me compile this? i have instaled and reinstaled vscode & platformio but without any improvements. Can you help me a bit with this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.