This project shows how make a simple obstacle avoiding robot with the GoPiGo and an ultrasonic sensor. The GoPiGo keeps on moving till it encounters and obstacle and stops as soon as it does. You can try out his example to see how to use the GoPiGo and an ultrasonic sensor and adapt this program to make it work with you own projects.
- A fully assembled GoPiGo
- A decent battery pack providing atleast 9V (recommended 12V battery pack of 8AA cells )
- Wifi Adapter
- An ultrasonic sensor
Connecting the Ultrasonic sensor
Attach the Ultrasonic sensor on the servo mount or on top of the GoPiGo and connect the Ultrasonic sensor using a Grove cable to Port A1.
Setting up the GoPiGo
Make sure that the GoPiGo is set up properly and you have the updated software and firmware. If you are not sure about this, follow the guide here.
If the GoPiGo is properly set up, connect to the GoPiGo via SSH or VNC and open terminal.
Running the example:
- Go to the Ultrasonic basic Obstacle avoider folder:
cd Desktop/GoPiGo/Software/Python/Examples/Ultrasonic Basic Obstacle Avoider/
- Start the basic_robot_control.py example
sudo python basic_obstacle_avoid.py
Press ENTER to make the GoPiGo start moving. It will automatically stop when it reaches an obstacle
You can easily adapt this example to any project that you have in mind with the GoPiGo and the ultrasonic sensor.