This little app does an ultrasonic sensor scan with the servo. I only do the even degrees and limit the range from 30 degrees to 130 since that’s what’s directly in front of the bot. It saves the data to a list. If there are twenty results in a row that are of a safe distance, it turns towards that. If it’s all clear, it trots on forward. If there’s no path, it asks the user if it should turn around or quit.
It’s a work in progress and I’d love some feedback. Here’s the script on GitHub
I’ll be posting a blog post about it soon on my project’s website.
I want to figure out how to post this information to a website and move past the console to control it. I’m also working to be a lot more precise with finding a safe angle (my current solution is very crude).