SloBot – experiments with sonar

I’ve been starting to knock things into shape today – haven’t done a lot but it’s a start.

Have added a new “SLAM” class (for Simultaneous Location And Mapping) which doesn’t do much. The constructor performs a 360o rotation and prints x,y distances of any object from the robot using the HC-SR04 sonar sensors with the MPU-6050 providing rotation data. Here are a couple of plots…

360o Rotation, Distance from Sensor #0

360o Rotation, Distance from Sensor #0

That’s just for one of the sonar sensors. From a different part of the room (unfortunately), here are all the sensors at the same time:

Full sensor scan

Full sensor scan

I’m not convinced that the full sensor scan is correct yet. I think the best thing to do is to place SloBot on a better surface and plot the sensor data for each individual sensor in turn. If I look at the full scan then I wonder if some of the sensors are being affected by the LEDs on the Gertduino. I’m using pins 9-13 for the sonar sensors and the Gertduino has LEDs on 9, 10 and 13. The Gertduino manual says:

The LEDs are not directly connected but are buffered and thus do not give any significant load on the signal pins.

I suppose it depends on how you define “significant” – Gert really knows his stuff so I suspect he means that it doesn’t matter.

Plotting them individually would seem to be a better bet. I also need to work on the python, I’m still a beginner, especially with numpy, and write some really crap code. Time to read some of the Packt Publishing e-books I’ve bought.

Anyway, it’s a start and it’s looking much better than it was a couple of days ago 🙂

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *