Announcement

Collapse
No announcement yet.

Modern Robotics Range Sensor Spikes

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

  • Modern Robotics Range Sensor Spikes

    Hello all,

    We have been using the MR Range Sensor with our REV hub using a level shifter and sensor cable adapter. We found that the sensor returns good values except sometimes it returns values of 255 and we don't know why. Could anybody help with this?

    Thank you,
    Ishaan
    FTC 9794
    Wizards.exe

  • #2
    When it doesn't receive an echo, it will return 255. This is expected. Our code keep track of the previous Range sensor reading and if it gives us 255, we throw away the bogus data and return the previous data instead.

    Comment


    • #3
      We are having to do the same thing. I was just wondering if there was any way to prevent this.

      Comment


      • #4
        Our team found out the hard way that, for whatever reason(s), your opmodes will occasionally get bad samples from your sensors. This is an opportunity for teams to find this out the easy way and design your sampling algorithms accordingly.

        Comment


        • #5
          Something like this might work.
          if (math.abs(senseValue - prevSenseValue) > 100) {
          senseValue = prevSenseValue;
          }
          else {
          prevSenseValue = senseValue;
          }

          or ...
          if (senseValue == 255) {
          // Ignore it
          senseValue = prevSenseValue;
          etc.

          Although personally, I'd be tempted to sample pretty quickly and run it through a fairly strong first order filter.... and ignore any changes that were greater than 100 counts.
          Mentor, teams 8578 & 11959

          Comment

          Working...
          X