From MAE/ECE 148 - Introduction to Autonomous Vehicles
Jump to navigation Jump to search
R.O.B.O. B.O.I., the autonomous robot star of Team 5 - the RoboBuds.

2018 Fall Team 5 sought to incorporate object avoidance and GPS capabilities into the autonomous vehicle. They built upon the work completed by Project GPS [1] by improving the path calibration of the GPS using a magnetometer and implementing the ability to avoid obstacles using ultrasonic sensors.

Team Members


Fall 2018 - The RoboBuds

  • Bryn Henning - Mechanical Engineering, B.S.
  • Ronnie Lusk - Computer Engineering, B.S.
  • Jacqueline Villalobos - Electrical Engineering, B.S.
  • Yue Wen - Mechanical Engineering, B.S.
  • R.O.B.O. B.O.I. - Really Outstanding Bot Object Being Operated Independently

Overview of GPS and Obstacle Avoidance

Global Positioning System (GPS) is a navigation system that uses satellites to send geolocation and time information to a GPS receiver located on or near Earth. If there is an unobstructed line of sight between a particular location and four or more satellites, then its geolocation and time information can be recorded. While GPS can be used to control traffic signals and synchronize cellphone towers, it is most commonly associated with navigation systems in cars and mobile electronics. The data collected for navigational purposes provides global coordinates in longitude and latitude. For more information about how a GPS works, please visit the Official U.S. Government informational website. [2]

Object Avoidance can be accomplished through different types of sensors, such as depth sensors or ultrasonic sensors. This is already implemented in many cars that have detection on the front, back, and sides, which can then trigger lights or alarms to alert drivers of passing cars and close objects. In autonomous vehicles, the object avoidance must also be able to trigger a brake mechanism so that the vehicle can stop on its own when there is an object in the way of its trajectory.

Systems with high-precision GPS, accurate localization, and object avoidance capabilities are essential to the functionality of autonomous vehicles, especially civilian cars. An autonomous car must be able to travel from one destination to another, while remaining within its own lane with as little need for correction as possible. In addition, it must be able to avoid hitting pedestrians, cars, and other obstacles so that it can maintain the safety of the passengers and everyone else in the area.

Project Overview

2018 Fall Team 5 sought to improve upon Project GPS's DonkeyCar module so that an IMU could be used as a magnetometer to provide more efficient path correction. Project GPS had the autonomous vehicle follow many GPS points so that it would manually correct itself at every in-between point when traveling from one major point to another. However, with a magnetometer, R.O.B.O. B.O.I. could continuously correct its steering angle when traveling to a coordinate point; therefore, less coordinate points were needed in order for it to follow a set GPS path throughout Warren Mall.

In addition, two ultrasonic sensors were used to detect obstacles. One sensor was placed at the base of the camera mount to detect obstacles on the ground, and the other sensor was placed at the top of the camera mount (the highest point of the vehicle) so that it could detect taller obstacles. If there were objects that were tall enough to trigger the top sensor but not the bottom sensor, it would still cause R.O.B.O. B.O.I. to stop; however, if there was an obstacle that did not trigger any of the sensors, like a chair, R.O.B.O. B.O.I. would be able to pass under it. Both sensors were placed parallel to the base of the camera mount.

Hardware and Schematics


Device Parts

  • Arduino Uno
  • BNO080 IMU - used as a magnetometer
  • GPS/GLONASS U-blox7 - a USB GPS
  • Two Ultrasonic Sensors - must be able to be paired with an Arduino Uno

In the image on the right, all of the above components are visible except for the second ultrasonic sensor, which is located directly underneath the sensor that is visible.


Fall2018Team5RobotSchematic.png Fall2018Team5SensorSchematic.png

The figure on the left illustrates how all of the given, initial components connect together to enable for basic functions, like the throttle, steering, and emergency brake lock. The schematic shown in the figure on the right demonstrates how the IMU, LED, and both ultrasonic sensors connect to the Arduino Uno on a central breadboard.

IMU Magnetometer

{{#ev:youtube|https://www.youtube.com/watch?v=mgniN0XUjwQ&feature=youtu.be%7C165x300%7Cright%7CCalibration of IMU BNO080 Magnetometer |frame}} The BNO080 IMU was used as a magnetometer so that the angle between the IMU heading and the desired coordinate location could be calculated. This angle could then be then used as an input to tell R.O.B.O. B.O.I. how much it needed to steer as it drove to the point. The IMU measured the angle every 50 milliseconds, which enabled R.O.B.O. B.O.I to also correct its path every 50 milliseconds; therefore, it could travel to a destination with fewer helper-points in between.

In order to calibrate the magnetometer, the IMU must be rotated slowly by about 180 degrees and then back to the original position in each axis (roll, pitch and yaw). For more information about how magnetometer calibration works and on hard and soft iron corrections the following Engineering Zone website may be useful. [3] As the magnetometer becomes calibrated this will cause a change in the output of the magnetometer accuracy status. In order to visually be able to determine whether the magnetometer was calibrated a RGB LED was implemented. If the status of the magnetometer was unreliable or low the LED would shine in red and if the status was medium or high the LED would be illuminated in green. This helped determine when the magnetometer was ready to use and if the calibration reliability was lost along the route R.O.B.O. B.O.I. traveled.

When using the magnetometer in the BNO080 IMU, values are outputted as x, y, and z values describing the strength of the magnetic field. For this project, it was essential to know the direction the robot was facing in order to then be able to correct for the desired direction to reach the next GPS point. The degrees were calculated by coding each quadrant case R.O.B.O. B.O.I. could face individually. The average was also taken of the 4 most recent measurements in order to ensure that accuracy and stability of the measurements made.


{{#ev:youtube|https://https://youtu.be/8_2Cs9v9VLI%7C165x300%7Cright%7C%7Cframe}} For detailed information on the function and code that enables the GPS to work, please see Project GPS. The work they did was excellent, and for the most part only minor configuration changes were needed to get the GPS working in our project.

The main improvement we have made comes in terms of accuracy. While this is not necessarily a testament to our personal ingenuity, R.O.B.O. B.O.I. is more accurate than previous projects simply due to the GPS unit we used. It is able to reach within five meters of each goal, and we were able to lower the steering gain so that it reaches each destination in a more straightforward manner. Further accuracy improvements can be gained through the integration of an IMU. Although we currently have code to make the IMU work with our Arduino, the changes needed to integrate it with the GPU have not yet been made.

Additionally, we added two sets of paths; one that goes from Warren lecture hall to Jacobs, and another that goes from Jacobs to Warren lecture hall. While it was trivial to gather these coordinates, special note should be taken of how far apart they are spaced out and their placement. The car still has limitations. It will try to take the straightest path to a point outside of some swerving to calibrate its direction. Put a point too far or around an obstacle and it may struggle to find a way there.

This issue can be remedied, to a degree, with object avoidance. See the section below.

Ultrasonic Obstacle Avoidance

The two ultrasonic sensors detect the distance of objects in front of the car. They are connected to the Arduino, which processes their data and performs some filtering to smoothen out the reported distances. Then it prints out these distances to the pi, which receives in byte form. A quick overview of the relevant ultrasonic files below will explain what happens from there.

ultrasonic.py is a donkeycar part that collects the data from the ultrasonic sensors, parses it for the distances, and then returns a stop_cmd if the distances are less than the threshold values. These threshold values are simply variables that can be changed at the top of the file.

ultra_gps_manage.py, is a modified manage.py that includes a call to the GPS part, ultrasonic part, and takes some input coordinates.

ultra_planner.py, which performs calculates to direct the car given the output from gps.py and the input coordinates. With the addition of the ultrasonics part, it will make the car stop when ultrasonics.py returns a stop_cmd value of true.

These files are iterations upon the original gps.py, gps_manage.py, and planner.py of the original project gps. Additionally, much of the work here was borrowed from 2018SpringTeam3 and modified to fit our project. Notably, we cut out the kiwi-bot design and features they implemented. We made changes to ultrasonic.py to fit our design and work more consistently.

Conclusion and Future Work

In the end, R.O.B.O. B.O.I. was able to follow a set GPS path throughout Warren Mall while stopping for obstacles, like people passing by. In addition, the IMU can be calibrated easily and used for more accurate path correction when driving between each GPS point.

Room for Improvement

  • Train the robot to avoid grassy areas with the same method used to run autonomous laps around the tracks
  • Implement Open CV to train robot to recognize grass.
  • Add ultrasonic sensors on the side of the vehicle so that it can go around larger objects and be able to sense when it is clear to pass by them.


  1. https://guitar.ucsd.edu/maeece148/index.php/Project_gps
  2. https://www.gps.gov/
  3. https://ez.analog.com/mems/w/documents/4493/faq-hard-soft-iron-correction-for-magnetometer-measurements
  4. https://github.com/rluskDev/robo_boi