Body: <p>A group including myself are using the Lego Mindstorm kit to design a robot that is going to compete in a school competition.  However, the sensors aren't as reliable as we would like them to be, particularly the ultrasonic sensor, which is what we're using to judge how far away objects are from our robot.  The problem that we face is that every so often the sensor returns a value that is just wrong: in a set of 3 datapoints for an object that is 45 units away, we'd possibly get values like 45, 45, and then 186.  The erroneous values are not consistent, nor is the amount by which the error occurs.  We also can't judge the probability of an erroneous value occurring.  Our current algorithm takes the average of a small number (i.e. 3) of datapoints, but we've realized that if the number of datapoints is small, then the average could be distorted greatly by erroneous values.  If the number of datapoints is large, then it takes a long time for the robot to get all of the sensor readings.  </p>
  
  <p>What do you recommend as a process to reduce the impact of erroneous sensor readings?</p>
  
  <p>I'm sorry if I'm posting this question in the wrong location, but this problem seemed more closely linked to mathematics than to programming.  </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-03-10T10:14:53.193Z
Comments.Text: Are the items you're tracking moving at all (i.e. other robots) or are they static? If they are static you could just discard the results based on your current speed and previous changes in distance...
Comments.UserDisplayName: Zhaph - Ben Duguid
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-03-10T18:23:02.200Z
Comments.Text: What is essentially happening with the robots is that we're using them to locate small, scattered, stationary canisters which we then need to capture and move to a corner of the 'field.' Consequently, the current algorithm is to basically move to somewhere in the center, rotate and take samples (non-continuous, btw) of the distances it sees, and then try to go for the best choice. Consequently, the objects that I'm trying to find are static (though there is another robot on the field at the time). However, the robot is not moving at the time either. We just want to reduce the error we get.
Comments.UserDisplayName: Amndeep7
Tags: <programming><sensor-ultrasonic>
Title: How to minimize the impact of erroneous sensor readings?
UserDisplayName: Amndeep7
ThreadText: # How to minimize the impact of erroneous sensor readings?
  
  (Asked by: username_0 on 2014-03-06)
  
  A group including myself are using the Lego Mindstorm kit to design a robot that is going to compete in a school competition. However, the sensors aren't as reliable as we would like them to be, particularly the ultrasonic sensor, which is what we're using to judge how far away objects are from our robot. The problem that we face is that every so often the sensor returns a value that is just wrong: in a set of 3 datapoints for an object that is 45 units away, we'd possibly get values like 45, 45, and then 186. The erroneous values are not consistent, nor is the amount by which the error occurs. We also can't judge the probability of an erroneous value occurring. Our current algorithm takes the average of a small number (i.e. 3) of datapoints, but we've realized that if the number of datapoints is small, then the average could be distorted greatly by erroneous values. If the number of datapoints is large, then it takes a long time for the robot to get all of the sensor readings.
  
  What do you recommend as a process to reduce the impact of erroneous sensor readings?
  
  I'm sorry if I'm posting this question in the wrong location, but this problem seemed more closely linked to mathematics than to programming.
  
  **Tags:** programming, sensor-ultrasonic
  
  > **Comments:**
  > **username_1**: Are the items you're tracking moving at all (i.e. other robots) or are they static? If they are static you could just discard the results based on your current speed and previous changes in distance...  
  > **username_0**: What is essentially happening with the robots is that we're using them to locate small, scattered, stationary canisters which we then need to capture and move to a corner of the 'field.' Consequently, the current algorithm is to basically move to somewhere in the center, rotate and take samples (non-continuous, btw) of the distances it sees, and then try to go for the best choice. Consequently, the objects that I'm trying to find are static (though there is another robot on the field at the time). However, the robot is not moving at the time either. We just want to reduce the error we get.  
  
  ---
  
  ## 0 answers
  
  