Theoretically, the raw sonar readings should always read within the range [0, 255] (i.e., an 8-bit unsigned integer). However, I'm assuming I've made an error somewhere in calculations because I occasionally encounter very large readings.
This is likely due to an unaccounted for divide-by-zero, so take some time to find and address this.
Temporary Work Around
For now, I've simply clipped the normalized readings to the expected range when this occurs (i.e., [-1.0, 1.0]).
Overview
Theoretically, the raw sonar readings should always read within the range [0, 255] (i.e., an 8-bit unsigned integer). However, I'm assuming I've made an error somewhere in calculations because I occasionally encounter very large readings.
This is likely due to an unaccounted for divide-by-zero, so take some time to find and address this.
Temporary Work Around
For now, I've simply clipped the normalized readings to the expected range when this occurs (i.e., [-1.0, 1.0]).