The range finder returns -1.0 when the path is clear. Used carelessly, that magic number reads as a distance of minus one metre. Model the reading as Option, handle both cases, and ease off only when something is genuinely close.
Predict firstA range finder returns -1.0 to mean ‘path clear.’ If you treat that reading as a plain number in your control law, what goes wrong?
A magic sentinel silently becomes data: −1.0 flows into the math as ‘minus one metre’ and the rover reacts to nothing. Option forces you to handle ‘no reading’ explicitly — no null, no phantom.