Announcement

Collapse
No announcement yet.

MR Gyro has consistent measurement error.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MR Gyro has consistent measurement error.

    I've been playing with Field-Centric driving with an Omni Bot, using the MR Gyro to maintain the heading of the Robot.

    After doing a bit of driving around the field, I noticed that the fwd and sideways lines weren't parallel to the filed perimeter any more.

    I wasn't completely surprised, since I was ready to accept gyro drift.

    What surprized me after some testing was that the gyro wasn't drifting, so much as it wasn't accumulating full turns as multiples of 360.

    Note: I'm using the sample SensorMRGyro opmode to display getIntegratedZAxis(), but the same effect is visible with regular getAngle().
    I'm just manually rotating the robot (while it's on the ground).

    What I discovered was if I start the program and calibrate the gyro it reads zero and stays locked there.

    If I rotate the robot by 1 full turn (aligning a flat side against a wall to register the 0 degrees mark) I consistently get a new heading of 366 degrees more.
    eg: IntegratedZAxis reads -366 and Angle reads 6.
    So if I do 10 turns, I get an integrated heading of 3660 instead of 3600....
    But here's the odd thing, If I unwind the 10 turns I get back to almost exactly 0 degrees (within a few).

    So It's not drift, but instead it looks like an accumulation math/rounding/truncation error.
    It counts up and down to much in both directions.

    I wondered if I was turning too fast, although I was going slow and taking about 7 sec for a full rotation.
    I tried rotating MUCH slower (10 sec) and it looked like the error went down to about 4 degrees per revolution.

    I'd be interested to see if anyone else is seeing this.
    Phil.

  • #2
    FWIW our coder kid put in a modulo 360 on the read back from the MR gyro. His take was that it simply accumulates degrees in any direction. As it if you turn "positive" it will just keep counting degrees you've turned, which is only your heading for your first revolution... after that it's more than 360 of course... If you know in advance it does this I suppose it could be handy sometimes - like if you design code to just add and subtract from current heading when doing things and you never need to worry about properly handling going from zero to 359 and such. But it can also get really confusing. I simply took his word for it though and didn't really test it myself.

    Comment


    • #3
      I would also add that if you supposed there is a small scale factor error, in addition to a bit a drift, you would see about 10 times that error after spinning the robot ten times in one direction.

      Heading error might be simply modeled as H = mX + b(t)

      In an ideal world b(t) is zero, but as there is drift over time the longer you do anything without a reset the bigger in magnitude b gets.
      m would ideally be one. But if you got six degrees of error in 10 turns I suppose your gyro has m = 1 - (0.6/360). Or 1+ depending on signs in your example.

      Not great but also not bad for a little cheap mems gyro in a plastic case for kids.

      - Z

      Comment


      • #4
        Originally posted by zain View Post
        I would also add that if you supposed there is a small scale factor error, in addition to a bit a drift, you would see about 10 times that error after spinning the robot ten times in one direction.

        Heading error might be simply modeled as H = mX + b(t)

        In an ideal world b(t) is zero, but as there is drift over time the longer you do anything without a reset the bigger in magnitude b gets.
        m would ideally be one. But if you got six degrees of error in 10 turns I suppose your gyro has m = 1 - (0.6/360). Or 1+ depending on signs in your example.

        Not great but also not bad for a little cheap mems gyro in a plastic case for kids.

        - Z
        Actually, it was 60 degrees in 10 turns (which is why I noticed it), so m = 1 - (6/360) but the solution is still sound.

        I can just scale my integratedZAxis value by 0.98333

        Don't know why I didn't think if it. Obvious in hindsight...

        Thanks

        Comment


        • #5
          Originally posted by Philbot View Post
          ...

          What surprised me after some testing was that the gyro wasn't drifting, so much as it wasn't accumulating full turns as multiples of 360.

          .
          Phil.
          I thought that this was gyro drift also, until I saw that the gyro would stay constant as long as it moved in a straight line. I realized what the problem is:

          Thought experiment... grasp your robot, tilt it 90 degrees towards you, turn around 360 and then put it down. it seems like you've turned the robot around 360 degrees, but you've not rotated it about the z axis AT ALL. try titlting it 45 degrees towards you, rotating it around and put it down, and you will have integrated (roughly) 180 degrees of motion about the z axis.

          Now, if your z axis is not perfectly vertical, and you turn the robot around 360 degrees, it will not have rotated 360 around the z axis. Our gyro is about 2 degrees off vertical, so it comes up a few degrees short on a 360 degree rotation. While trying to get it perfectly horizontal (or parallel to the floor) could be possible, we're planning on just calibrating it out.

          Comment


          • #6
            Yes, I wondered too about this when testing the gyro the other day, haven't thought through it, but wondering:

            Is the gyro frame of reference defined by the gravitational vector after calibration, or is it manufactured into the chip, ie is z parallel to the gravitational vector, or just perpendicular to the board? Or is that all supposed to be taken into account for us?

            I can imagine some discrepancy if they're not one and the same, rare that the sensor will be perfectly parallel to the floor surface...

            sort of like magnetic north isn't true north....

            Comment


            • #7
              Originally posted by korimako View Post
              Yes, I wondered too about this when testing the gyro the other day, haven't thought through it, but wondering:

              Is the gyro frame of reference defined by the gravitational vector after calibration, or is it manufactured into the chip, ie is z parallel to the gravitational vector, or just perpendicular to the board? Or is that all supposed to be taken into account for us?

              I can imagine some discrepancy if they're not one and the same, rare that the sensor will be perfectly parallel to the floor surface...

              sort of like magnetic north isn't true north....
              I don't "think" the gravitational frame of reference comes into it. In theory the gyro should work the same in any "constant" plane of rotation.

              In researching the native interface for the Gyro, I saw that there is, in fact, a way to tweak this ZAxis integration error. There is an adjustment constant that you can change.
              However, not wanting to experiment with a potentially untested interface, I took the option of just applying my calculated scale factor.
              It seems to work very well over many turns.

              Comment


              • #8
                Originally posted by korimako View Post
                Yes, I wondered too about this when testing the gyro the other day, haven't thought through it, but wondering:

                Is the gyro frame of reference defined by the gravitational vector after calibration, or is it manufactured into the chip, ie is z parallel to the gravitational vector, or just perpendicular to the board? Or is that all supposed to be taken into account for us?

                I can imagine some discrepancy if they're not one and the same, rare that the sensor will be perfectly parallel to the floor surface...

                sort of like magnetic north isn't true north....
                My point before is that z is perpendicular to the board, but not the floor. I had it on a piece of metal that was bent, so that it was 10 degrees off from the floor, and I got huge errors. You want the base of the gyro to be parallel to your wheels' contact plane with the floor.

                Comment


                • #9
                  Originally posted by robgcarlisle View Post
                  My point before is that z is perpendicular to the board, but not the floor. I had it on a piece of metal that was bent, so that it was 10 degrees off from the floor, and I got huge errors. You want the base of the gyro to be parallel to your wheels' contact plane with the floor.
                  Sorry, I missed the original post. Yes, I agree with your analysis. You need to keep the gyro as flat to the plane of rotation as possible. In my case I had a 3 wheel omnibot with the gyro attached to the base plate, so it's as flat as I can get it.

                  Phil.

                  Comment

                  Working...
                  X