Ultrasonic Basic Obstacle Avoider

Ultrasonic Basic Obstacle Avoider

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.

u_ranger2 (2)

Hardware needed:

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:

  1. Go to the Ultrasonic basic Obstacle avoider folder:
     cd Desktop/GoPiGo/Software/Python/Examples/Ultrasonic Basic Obstacle Avoider/

    change_folder

  2. 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 obstaclerun_program

You can easily adapt this example to any project that you have in mind with the GoPiGo and the ultrasonic sensor.

Have a question? Go check out our support page here or post it on the forums here