Announcement

Collapse
No announcement yet.

The EV3 input port timing bug (related to Gyro drift)

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

  • The EV3 input port timing bug (related to Gyro drift)

    I have found a bug in the EV3 firmware. I call it "The EV3 input port timing bug". It can make the Gyro sensor drift at any time (completely random) as long as the robot is moving (and even if the sensor is not used at that time). I know that this sensor is bringing a lot of frustration to a lot of FLL team (also to my team) and I do believe that this bug has a big responsibility for this.
    If you go to the topic named "EV3 Gyro Sensor drift" page 8, you can find Pascal (posting on the 6 September 2016) this message:" The Gyro always starts fine but eventually get out of whack and start to drift (roughly 4 - 5 times / test hours). We can't pinpoint the causes that make the gyro to start drifting.". Those two sentences are exactly describing this bug. There is not a single word to add or to remove.
    From what I have seen, the first generation of Gyro (date code number xxN2 and xxN3) might not have the ability to trigger this bug. My team have a few second generation sensors xxN4 and xxN5 that are all showing this bug at different rates (one of them, almost never, and one of them every few minutes).
    To find it, I had to put an oscilloscope on the wire of the sensor and understand the protocol used between the sensor and the EV3. I will soon post a document describing this "bug chase" and another one describing the inner part of the two known types of Lego Gyro sensor.
    With the help of Sanjay and Arvind Seshan from EV3 Lessons.com, I have contacted someone at the Lego company, but it is not looking like their highest priority. Anyway, the guy promised me to have a look at it somewhere in the future...
    You can try to reproduce this bug by taking an EV3, connect a Gyro Sensor (xxN4, N5 or N6) with two black clips on the EV3, put a cable to port 1 and go to "port view" to see the Angle on the screen. It should be stable (if not, de-plug and re-plug the sensor). Then slowly turn (a few degrees per second) the EV3 from right to left and from left to right. Depending on the sensor, after less than a minute, you should see "---" on the screen instead of the angle (it means the Gyro sensor is performing a reset). If you continue moving during this reset, the Gyro sensor will have a drift after that.
    Like I have already said, there are sensors that are doing that very often and other almost never (I will explain why in my document). At least, with this test, you can sort the sensors if you have several. You might automate this test by using a very simple robot to move the unit at a very low speed and display the Gyro sensor angle on the screen. Let it run and look from time to time if the Gyro sensor is drifting. It is important that the robot is changing the direction because some Gyro sensors can only reproduce the bug in one direction.

    I would like to know, now that I have given some details about this bug, who has seen it? How many teams are struggling with it? Who would like to throw this sensor through the window (or has already done it)?

  • #2
    I have seen this as a result of putting stress on the cable. I did a similar experiment where I attached the sensor to a motor and commanded the motor speed to be a sinusoid. Occasionally I would see the gyro do a hard reset, report NAN and then take on a drift. I modified my configuration to remove any strain on the cable (I attached the sensor to the EV3 and rotated the EV3) and the problem went away. I have worked with many teams that get a hard reset while running their missions. Usually we can trace it down to backing into a wall, and bumping the cable. I can also make it happen by bending the cable. I have seen this with mostly older (N2 N3) sensors because that is what we have to work with. I've heard other reports and assumed they were related.

    I'll have to track down some newer sensors and try your test. Is this in any way related to the ability to reset the sensor by telling it is a IR sensor? From what I've read that causes some sort of timeout which makes the sensor do a hard reset.
    Last edited by Dean Hystad; 10-25-2017, 05:10 PM.

    Comment


    • #3
      Originally posted by Dean Hystad View Post
      I have seen this as a result of putting stress on the cable. I did a similar experiment where I attached the sensor to a motor and commanded the motor speed to be a sinusoid. Occasionally I would see the gyro do a hard reset, report NAN and then take on a drift. I modified my configuration to remove any strain on the cable (I attached the sensor to the EV3 and rotated the EV3) and the problem went away. I have worked with many teams that get a hard reset while running their missions. Usually we can trace it down to backing into a wall, and bumping the cable. I can also make it happen by bending the cable. I have seen this with mostly older (N2 N3) sensors because that is what we have to work with. I've heard other reports and assumed they were related.

      I'll have to track down some newer sensors and try your test. Is this in any way related to the ability to reset the sensor by telling it is a IR sensor? From what I've read that causes some sort of timeout which makes the sensor do a hard reset.
      I agree with all of this. I have never seen any cable problem but I have no problem to believe that they can exists.

      Originally posted by Dean Hystad View Post
      I've heard other reports and assumed they were related.
      Now you know that they might not all be related. I expect a lot of people to have the same problem as Pascal (see my original post) that are coming from this bug. The fact that at least two generation of Gyro are existing does not make things easy.
      Originally posted by Dean Hystad View Post
      I'll have to track down some newer sensors and try your test. Is this in any way related to the ability to reset the sensor by telling it is a IR sensor? From what I've read that causes some sort of timeout which makes the sensor do a hard reset.
      I do not think so because some Gyro of the second generation do not cause this timing bug easily. And what you are describing is always happening.

      Comment


      • #4
        I made a robot with a really wide track (400 mm) and ran the attached program. The robot rotates at about 1 deg per second. I ran this for an hour with My N2 generation sensor without ever seeing drift. I then ran for an hour with a N3 generation sensor and never saw any drift. Sunday I should get a N4 generation sensor to test.
        Gyro Test.JPG
        To give my robot a really wide track I just jacked up one side using a long beam and a pivot.

        Robot.JPG
        Last edited by Dean Hystad; 10-26-2017, 11:14 PM.

        Comment


        • #5
          Thanks very much Dean for your test and your time. Could you get several second generation Gyro?
          I will soon, probably in the next 24 hours, post here a (long) document giving all the secret of this bug and what I had to do to find it.

          Comment


          • #6
            You can find my document about the bug here, attached.
            I still have another document to post about the "inside" of the first and second generation Gyro sensor. It will probably take at least one more week because I have now access to 3 new Gyro sensors coming directly from Lego with the date code 29N7 (all of them). I would like to investigate them as I think that a third generation is coming. The MEMS component at the heart of the second generation sensor is out of production (like the one of the first generation).
            Attached Files

            Comment


            • #7
              If you want to learn more about the Lego Gyro sensor, you can have a look at this document...
              Attached Files

              Comment


              • #8
                After you upload you have to insert for it to appear in your post and for others to see it. I don't see any attached documents. Is the problem on my side?

                Uploads used to be visible and I had many posts with attached screen images or programs. When the forum was updated these all became invisible. The uploads are still there, but I have to go through the old posts and include the images or insert links to the files for anyone else to see them. It is tedious. I shouldn't post so often.
                Last edited by Dean Hystad; 11-04-2017, 11:02 AM.

                Comment


                • #9
                  Is it better now?

                  Doc-EV3InputPortTimingBug-V1.0.pdf Doc-WhatIsInTheGyrosensor-V1.0.pdf

                  Comment


                  • #10
                    Originally posted by NiceCoach View Post
                    Is it better now?

                    [ATTACH]n82200[/ATTACH] [ATTACH]n82201[/ATTACH]
                    I love the analysis! Thanks!

                    Comment


                    • #11
                      NiceCoach Nice job on the analysis. Thank you for spending all this time. We are passing your research on to a few others who will be interested.

                      Wondering how you figured out the part numbers, schematics, etc. We also opened our gyro sensor up, but had a hard time reading the numbers. All we could do is make some guesses.
                      **************************
                      EV3Lessons.com and FLLTutorials.com Founders
                      FLL #51 World Festival Champion's 2018 (retired)
                      FRC Not the Droids You Are Looking For (Rookie season 2020)

                      Comment


                      • #12
                        Thanks for the kind words.

                        Originally posted by EV3Lessons View Post
                        NiceCoach Thank you for spending all this time.
                        I have spent this time because I have enough of seeing children struggling with this bug (including my team). But the hardest part is to get this bug corrected.

                        Originally posted by EV3Lessons View Post
                        NiceCoach We are passing your research on to a few others who will be interested.
                        Please do. That also one of the goals.

                        Originally posted by EV3Lessons View Post
                        NiceCoach We also opened our gyro sensor up, but had a hard time reading the numbers. All we could do is make some guesses.
                        well, it is my job and I am not that young.

                        Comment


                        • #13
                          When you say saturating the gyro will cause it to drift, what do you mean? I shook the gyro like crazy and cannot make it drift. The angle is off, because the sensor moved faster than it can measure, but the angle is stable. Are you saying I can introduce a persistant rate offset by saturating the sensor?
                          Last edited by Dean Hystad; 11-07-2017, 12:15 PM.

                          Comment


                          • #14
                            Originally posted by Dean Hystad View Post
                            Are you saying I can introduce a persistant rate offset by saturating the sensor?
                            Yes (be careful, I am talking about saturating the MEMS sensor). Take a gyro, connect it on an EV3 with a long cable and look at the angle on port view. Shock the gyro, for example against a plastic box. The most important is to shock it in a circular movement. Remember, we are looking at a gyro sensor, something sensible to rotating movements. After a few times, you should notice a small drift.

                            Comment


                            • #15
                              I cannot get the gyro to drift without a reset. I attached it to the EV3 and twisted my wrist back and and forth as quick as I could. When I stopped there was no drifting. I attached the sensor to a long cable and spun it like like a tiny tether-ball. No drift. Still on the cable I slammed it onto a carpeted floor. No drift. Finally I reattached the sensor to the brick and flipped them in the air. It spun so fast it was a blur, but still no drift. I know 2000 degrees per second is pretty fast, but if I wasn't saturating the sensor I don't see how it could be done with even the roughest robot rustler.

                              Comment

                              Working...
                              X