Friday, October 17, 2014

Sonar Measurements While Moving

I've been worried about two things regarding the sonar sensors, HC–SR04 units:
  • The sonars may have a lot of variance in their measurements, according to reports on the web.
  • Measurements from the sonars may be affected by movement, or by noise from the motors.
So I wrote a program to capture one sonar distance as the robot moved, and captured the robot position and sonar distance periodically. The result was surprisingly accurate:


The wall distance before about 3 seconds was from an intermediate obstacle to the left. Robot distance traveled is based on the wheel encoders, which have 30 segments per revolution, about 7mm per tick. The wall distance was measured by an HC–SR04 sensor pointing forward.

I was expecting a lot more variation in the sonar sensors (distance to wall). The actual values are accurate enough that little smoothing or filtering may be necessary. There are more wiggles in the speeds, because I calculated those based on measurements in the interval, 1/4 second.

Further Questions

Do the sonar sensor readings have more variance if the wall is at an angle?

Do the sonar sensors interfere with each other if they are fired close together?

Is there electrical noise from firing the sonars that interferes with the measurements?

No comments:

Post a Comment