I noticed that in some cases the vector pointing to an obstacle is negative (1/2 ticks).
You can use https://github.com/xtuc/baagent to reproduce this issue.
It seems that I already had to mitigate the issue some time ago: https://github.com/xtuc/baagent/blob/master/src/index.js#L50-L54