Announcement

Collapse
No announcement yet.

Gyro Sensor Inconsistent

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

  • Gyro Sensor Inconsistent

    Our team is using the Modern Robotics Gyro Sensor to turn 90 degrees. However, in 1/5 times, it stops working.

    Before beginning the turn, we calibrate the gyro sensor and while it's calibrating, it turns a solid blue color. Once it finishes, it starts flashing indicating that it's operational. However, sometimes, the robot starts to turn even when the gyro doesn't finish calibrating. Sometimes, it finishes calibrating but yields incorrect headings and our robot only turns 10-20 degrees.

    Is anyone else having issues with the sensor? If so, how were you able to fix the issue? I don't think there's anything wrong with our code because it works perfectly fine most of the time.

  • #2
    Could it be a coding issue? Make sure to check gyro.isCalibrating() before putting power to your drive motors. Also if you are initializing servos before calibration, you may need to add a sleep() or something else to be sure the robot is not moving during calibration.

    Comment


    • #3
      We are checking if the gyro finishes calibrating. As of now, we aren't using any servos on our robot. Could it be a bad sensor?

      case 6:
      while (autoBot.gyro.isCalibrating()) {
      }
      state++;
      break;

      case 7: // Fix later
      state++;
      break;

      case 8:
      autoBot.setSpeed(.15, -.15, .15, -.15);
      state++;
      break;

      case 9:
      while (autoBot.gyro.getHeading() < 90) {
      }
      autoBot.setSpeed(0,0,0,0);
      state++;
      break;

      Comment


      • #4
        I am guessing you calibrate in "case 5" immediately before incrementing state? Could the robot still have a little movement from whatever happened in case 1-4?

        Comment


        • #5
          That's a good thought, I'll try adding a sleep statement before calibrating and see if that helps. Is it confirmed that the gyro will bug out with the slightest movement during calibration?

          Comment


          • #6
            We've found it kind of inconsistent on how much slight movement will affect it, but an error of 70 degrees does seem like a lot. Making sure it is completely still can rule out a hardware issue if it corrects the problem. If you are still getting inconsistent turns after assuring a good calibration, I guess there could be a problem with the sensor itself? You can check to make sure it is plugged snugly into the Interface Module, but seems like you would get a message if there was a problem there or with a loose wire.

            If the problem persists & nobody else chimes in with more advice, I would contact Modern Robotics.

            Comment


            • #7
              We went through the process of stabilizing the robot completely before calibration but still no luck. We ended up using encoders to turn instead, they're much more reliable and consistent. Thank you for the tips!

              Comment


              • #8
                I realize it's an old thread, but I thought I'd add a bit to it.
                We use gyro's to turn with and have found them to be pretty reliable. We do the calibration during the "init" phase (using the standard OpMode) where there is plenty of time to calibrate before any motion is called for. If we want to re-zero it during the program, we just use the resetZAxisIntegrator() method to reset the zero position to the current position - which is instantaneous.

                Comment

                Working...
                X