ysoldak / HeadTracker

Zero configuration, auto-calibrating wireless DIY Head Tracker, for Nano 33 BLE and XIAO BLE Sense boards
The Unlicense
69 stars 9 forks source link

Add a magnetometer #54

Open Doncuppjr opened 1 month ago

Doncuppjr commented 1 month ago

I think the seeed would support it, but could the firmware be updated to support a magnetometer for better pan support? I think we would also need some kind of configuration options for defining which axis takes that input, as currently the tracker can be put into almost any orientation and depending on where you mount it, an axis represents the pan.

ysoldak commented 1 month ago

Do you have a link to a Seeed board with magnetometer?

Yes, this is by design -- you put the tracker on your googles any way you see best and then you map in your radio the channels accordingly. No need to configure also in HT.

Doncuppjr commented 1 month ago

No. The seeed has SCL, SDA pins, and perhaps something like this https://www.amazon.com/AITRIP-QMC5883L-Compass-Magnetometer-Raspberry/dp/B08ZHKDJHD/ref=asc_df_B08ZHKDJHD/?tag=hyprod-20&linkCode=df0&hvadid=693270340473&hvpos=&hvnetw=g&hvrand=36492099623008886&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9192860&hvtargid=pla-1949616210426&mcid=c136cb498293379ab57d185bcd935f53&th=1 could be soldered on to add a compass to the HT.

Doncuppjr commented 1 month ago

Maybe as both the seeed and mag are 3 axis, there could be a pairing pattern that would mitigate the need for configuration.

ysoldak commented 1 month ago

Sure, this is doable and we can define how a magnetometer board shall be mounted relative to main xiao board so we can skip configuration.

The usefulness though escapes me, since:

For a long time, Nano 33 BLE was the only board supported. It has an additional sensor, magnetometer, that head trackers usually use to eliminate pan drift. In practice, however, magnetometer adds more problems than solves. Magnetometer is very sensitive to environment and tricky to calibrate properly. In this project we do not use magnetometer and have a good zero-configuration automatic continuous gyro calibration instead to solve the drift problem. Already after first 5 seconds the calibration is good enough to stop the drift.

Can be a great fun addition. But only if we can make magnetometer auto-calibrate (I have some experiments in that direction). It's doable also, but as said probably is not worth the trouble.

Do you have problems currently with HT drifting on Xiao boards?

Doncuppjr commented 1 month ago

I don't know if I actually have drift problems. I'm just getting started with the HT, and some things don't work quite like I expect. I might try playing with the weights and see if that resolves what I'm experiencing, but it seems like drift might also be a factor. Maybe the HT is detecting a double tap and resetting or something.

I do wonder how important calibration actually is for this though. I don't expect the HT would actually need to output the heading to anything, but rather just a reference to the magnetic field to avoid any potential drift of the accelerometer. 

Doncuppjr commented 1 month ago

So I can confirm that I have a drift issue. I have the tracker inputs on a switch. I can sit down, double tap and everything is fine. Fly around a bit, hit the switch and my gimbal moves about 60 degrees to the left. Release switch, double tap, hit the switch, and everything is fine. Release switch, fly around a bit, hit the switch and the gimbal moves to the left again.