We are essentially creating an Ultrasonic Detection And Ranging (USDAR) that volition role the distance reading from the ultrasonic sensor to practice a LIDAR 2D mapping that uses the same regulation equally RADAR.
I bring already attached the ultrasonic sensor (Part 4) to the servo motor (Part 3) as well as mounted it to the GoPiGo robot car, therefore it's simply a thing of setting upwards as well as running the Python code which you lot tin let on on DexterIndustries GitHub. The basic obstruction detection tells the GoPiGo robot to deed forwards spell collecting readings from the ultrasonic sensor as well as when the GoPiGo robot is some an obstruction to stop.
The advanced obstruction detection code tells the GoPiGo robot to deed forwards spell reading the distance of angles as well as the XY coordinates, as well as therefore terminal as well as impress the values inwards a grid map.
After running the command above, the GoPiGo Robot starts moving as well as scanning: