My distance sensor seems to be off. 100 mm from sensor is reading 425 mm. Is there a way to reset it? Any ideas?
Try experimenting further. Set the sensor on the floor pointing at the wall and move it towards and away from the wall, allowing time to settle and read the brain, and compare what it prints (in both inches and millimeters) to how far away it actually is (with a ruler).
I did a brief experiment like this and found it to often be wrong by as much as an inch, and worse, to be inconsistently off: it would bounce around while the sensor was sitting still.
I don’t see any function for calibrating it or anything. (If you’re ever wondering about a sensor, you can check out the example projects for that sensor in VEXcode.)
The surface that it’s reflecting off of makes a great deal of difference in what sort of return you get. The smoother the surface, the (relatively) better it is. Also, there is a min and max range, according to the distance sensor page:
**Specification:**
* Measures distance from 50mm to 1m (2" to 38")
* Optimal range from 50mm to 450mm (2" to 18")
Also, are you reading that from code, or are you getting that from the Device Info page? If you’re using a program to print out, make sure you’ve got at least a 20msec wait in whatever loop you have going to give it time to update properly.
If the ideas in the previous posts don’t solve this for you, does it read correctly at closer distances ?
I have one Ultrasonic distance sensor that behaves a bit like that, nothing you can do really, it’s probably just damaged, they can be very sensitive to being dropped etc.
Thank you for the confirmation that someone else has experienced this. I like the idead of having a tape measure underneath it to get an accuracy comparison immediately. Great idea.
I have the robot print the distance on the brain. would you add the wait block before the print block or at the end of the loop?
I have the brain print the distance sensor information and the gyro information on seperate lines.
Something like this:
while (true) {
print("%0.1f", DistanceReading);
wait(20, msec); // Gives the distance sensor a chance to report again
}