Skip to main content
Up and Coming
March 29, 2013

Magnetic yaw correction

So I downloaded the SDK and looked over what you guys are doing in regards to sensor fusion. It looks really basic (having seen what several multicopter projects are doing to calculate orientation) and the magnetometer doesn't get used at all.

Now I don't have a Rift yet, but I imagine that drifts in the yaw axis and should be visible after some time. Any plans to use the magnetometer or are you open to suggestions? ;-)

P.S.: If EnableGravity is set to false, there doesn't seem to be any normalisation of Q.

    35 replies

    Up and Coming
    March 30, 2013
    I can get >45 degrees variation in yaw over 30cm horizontal movement in some parts of my flat :(

    Having the option of yaw correction through computer vision would be really good. AR markers is a really good idea to reduce performance impact, but the same can be done using PTAM/SLAM techniques so I don't need markers. I've used http://www.robots.ox.ac.uk/~bob/researc ... ptamm.html with some success. The great thing as well is that yaw compensation can be performed in a parallel thread, with periodic updates, and so won't incur latency penalties on the main headtracking/display pipeline. You'd need to be clever with the updates so it's not jumpy, but I think that's well do-able.
    Up and Coming
    March 30, 2013
    Sebbi: Well, if you don't notice any big heading spikes while moving around then I guess you are one of the lucky ones (looks like kingtut lives in the same building I do). Thanks for doing the experiment. I have tried multiple different compasses/phones (iOS and Android both) as well as more complex solutions (such as the SpacePoint sensor that claims to have "magnetic shielding") and they all report garbage in my apartment. Currently, I have 6 monitors, 3 computers, multiple speakers, tons of wires and other miscellaneous stuff going everywhere within a roughly 12x24 foot room. I don't know if anything in those is strong enough to make a difference (speaker magnets? hard drives?), but I have no idea what's in my walls which is probably what the issue is.

    kingtut: You likely won't be able to use PTAM/SLAM (at least an out of the box solution) because it will try to use features from the human, and those features will change their relative positions/orientations as the player moves (clothing deforming, arms moving, etc). Unless you meant to put a camera on the Oculus? Also, those algorithms are pretty expensive compared to simple marker techniques (where all you really need is a rectangle extraction). It looks like the Oculus has a very flat front, the so the marker will fit nicely there.
    Up and Coming
    March 30, 2013
    I have not received my dev kit yet, but judging by most reports, there seems to be a surprisingly small amount of yaw drift despite not using the magnetometer.

    In light of that, it would seem that the magnetometer data could strictly be used for feedback (rather than for heading) to further reduce drift. In such a case, any spacial distortions in the magnetic field would be irrelevant (unless it's dynamic) because you would only be looking for changes in the magnetometer values to conclude that gyro data is valid. Granted, this wouldn't completely eliminate drift or give you absolute orientation in the yaw axis, but it should stabilize the yaw further than it already is.
    Up and Coming
    March 30, 2013
    I'm not sure how you would make use of that feedback. The field changing may or may not indicate an actual change in orientation (and or position), so what exactly would you do with that information?
    Up and Coming
    March 30, 2013
    I doubt the distortions in the field are dynamic, so in any given spot the field should be consistent. So lets say you set the sensor somewhere in the room and don't touch it -- besides for the magnetometer's noise floor, its value should be consistent (perhaps truncate a few of the LSBs or put it through a low-pass filter) and will not drift, unlike the gyro. That means we could at least eliminate random drift due to the gyro's noise floor when the sensor is stationary by verifying that a rotation is actually occurring based on whether or not there are changes in the magnetometer's values. It's very rudimentary, and like I mentioned earlier, will not allow for absolute orientation, but it might help eliminate drift in the yaw axis a bit further.
    Up and Coming
    March 30, 2013
    Likely if you don't touch it you can get a constant reading, but there is no guarantee the rotation itself does not cause a translation (unless the compass is centered perfectly in the device). Also people will be naturally moving a little bit, and wouldn't work at all if you want to actually walk around. I guess my point is you will likely never be certain enough of anything to trust it more in the short term than the gyro itself. You might be able to detect if the gyro completely stops working or something.
    Up and Coming
    March 30, 2013
    bteitler: Yes, I was thinking of mounting the camera on the headset, it completely hadn't occurred to me that the camera would be mounted in a fixed location. The way I'm planning to use it all is quite mobile, wearing a laptop etc, so a fixed camera would have problems. However, if you're playing in a sitting position then your idea would be _much_ better than mine - lighter weight, and reuse the webcams many people already have for skype etc.

    As for processing cost, yes they are expensive but most modern computers have multiple cores, and most games don't take advantage of multiple cores well, so I think there wouldn't be much real impact. I can use the PTAMM library in real-time and it doesn't even make one logical CPU go above 80%. That said, for the fixed camera model, I agree a fiduciary marker on the front of the oculus would make most sense.

    msat: I think you're correct that most of the time the field will be consistent - it's the frame of my building which sucks rather than fields due to the contents (that said, I may do a survey with my YEIs - it'd be interesting to map out the fields in my map). If you're sat down, then any localised variation may be sufficiently low. The problems arise if you're standing, and moving around by tens of cm.

    What's important to know is the drift characteristics of the sensors - if rate of drift is constant, or slowly changing, then it's a relatively easy problem to filter out any large or unpredictable changes. If it's more chaotic, then life gets harder. I'm also wondering if the magnetometer reads in 3D, so you could detect and filter out if the primary magnetic field lines aren't parallel to the ground (as I believe they would be on most of the earth's surface).
    Up and Coming
    March 30, 2013
    Ah, I see, you are going completely wireless then? How do you plan to power the control box?
    Up and Coming
    March 30, 2013
    Yep - for FPS games I think wireless makes the most sense. For cockpit games then being sat down makes the most sense.

    I believe the kit needs ~800mA at 5V, which my laptop should be able to provide via USB. Failing that, it'll be easy enough to build a battery pack of rechargeable batteries. The beauty of mounting it all on webbing is there's no shortage of attachment points.

    I've 2x YEI 3 space sensors, one mounted to a weapon (top shot elite) and the other to my hip/waist. Now just need my rift to arrive :)
    Up and Coming
    March 30, 2013
    "bteitler" wrote:
    Likely if you don't touch it you can get a constant reading, but there is no guarantee the rotation itself does not cause a translation (unless the compass is centered perfectly in the device). Also people will be naturally moving a little bit, and wouldn't work at all if you want to actually walk around. I guess my point is you will likely never be certain enough of anything to trust it more in the short term than the gyro itself. You might be able to detect if the gyro completely stops working or something.



    Changes in the magnetic field over a given area will generally be gradual - it's unlikely that you'll get a particular value in one spot, and a completely different one several cm away (assuming we're talking about just translation here and not rotation). Even if it did, what I'm suggesting is just using the mag data as a simple verification factor for the gyro's data, and not for correction - something like: Is the gyro reporting angular changes? If yes, is there also changes in the mag readings? If not, ignore gyro data. This can only eliminate drift in certain cases, and is not viable for detecting discrepancies between actual rotations and measured rotations. It'll only prevent the world from slowly spinning in front of you.

    Being able to walk around is a whole 'nother ball of wax, with absolute orientation in the yaw axis being just one part of a much bigger challenge.

    If anything, I'm mostly concerned with head orientation relative to the body. For some games and control schemes where the player's head is locked to the body, drift is less of an issue. But lets say you're playing a game with head decoupling - such as if you're in the cockpit of a mech, race car, etc - drift becomes a huge issue because eventually you'll have a situation where you're physically looking straight ahead, but accumulated drift has you looking off to the right or left. The simplest way is to have a "re-center" button, but that sucks. There are multiple different tracking solutions that could be used, such as optical, magnetic (like Razer Hydra) and so on, but a simple approach may be to have a reference magnetometer strapped to your upper chest/back. Since the magnetic field is unlikely to be significantly different from your upper chest to your head, you can use the magnetometers to detect the differences in orientation relative to one another. This doesn't solve to problem of absolute orientation in the yaw axis either, but at least it'll keep your head pointed in the virtual world correctly relative to your body.

    @kingtut

    Even if the rate of drift were constant, the actual direction of it would never be, so it's a challenge no matter what. As for the mag sensor, I would be very surprised if it wasn't a 3-axis device.