Real Time Vehicle Tracking System

2016 Fall GATECH ECE4180 Final Project

Team member: Boa-Lin Lai Samuel Choi



This project design is the backend framework for an autonomous vehicle telemetry system to send instructions and receive coordinates of a vehicle.


The intent for this project is to simulate the backend telemetry system for an autonomous vehicle part of a larger autonomous vehicle network. Possible applications include but are not limited to automated airport vehicles, factory vehicles, and more. In such a network, each vehicle would have its own WiFi module, which has its own unique IP address, and would communicate using the address with the main controlling computer. Likewise, our robot has its own WiFi module, and our controlling computer was a laptop running a Python program. Once the robot and the laptop are on the same network, the computer is able to send instructions to the robot, and the robot will update its coordinates live to the computer when in motion to update its telemetry graph. The robot gets its coordinates by calculating its directional vector and entering it into a rotation matrix to calculate the next x,y location. The tracking we used reflects the path the robot traveled with good precision.

System Diagram


Each robot has 2 encodes for both wheels. The difference between them can be used to calculate the current robot location. Wifi modules is used for receiving data from python client and create an http server to put the real time data. The python client can parse the log data from the server, but also send the command to the robot.


  • mbed LPC1768
  • Encoders
  • ESP 8266 WIFI modules
  • Shadow Robot frame
  • Motors

Positioning Algorithm


For calculating the robot coordinates, we used data from the wheel encoders and an algorithm to calculate the robot’s position. We discovered that 25 ticks is about 1 inch and that the width of the robot from wheel center to wheel center was 6.25 inches. In the shown image, you can see that the angle theta is part of arcs L and R, with L and R representing the left and right wheel ticks respectively. We divide L and R by 25 every time to convert the ticks into inches. We can derive theta and the radius with the equations shown in the picture. However, what we are looking for is the distance from the point in between the wheels from the bottom of the angle to the top of the angle, so the distance is the magnitude m and the angle of that line is phi with respect to the line on theta = 0. We calculate m by calculating the sin and cos of r+3.25, because that is the center of the wheel at the angle of theta. Once we have m, we can find phi. With m and phi, we can add the sin and cos of phi times the magnitude m, add the cos result to x and sin result to y to get the new coordinates.

Pin Assignment

MbedDeviceDevice PinDevice 2Device 2 Pin
GNDExternal PowerGND Terminal
VINExternal PowerHigh Pin
H-BridgeSTBYPull UpVIN
GNDH-BridgeGND x3
P25R EncoderAnalog Out
P26L EncoderAnalog Out
P27Huzzah WiFi ModuleTX
P28Huzzah WiFi ModuleRX
GNDHuzzah WiFi ModuleGND
VINHuzzah WiFi ModuleV+

Main Program

Import programRT_Wifi_system

ECE4180 final project

Python Interface

For using this python script, we need to do the followings steps

  • List Find out the robot's IP address on change it in the script.
  • Create the specific movement for robot in cmdlist
    • 1 is left turn, 2 is right turn. each alphabet represents a distance unit.

# ECE 4180 
# ParseWeb version 1.0
# Author: Boa-Lin Lai
import math
import matplotlib.pyplot as plt
import time
import sys
from lxml import html
import urllib2
import select
serverUrl = "" # change the address for esp8266
  This file will parse the data from ESP8266 and plot the points in real time
def parseWeb(): 
   This module is used to get the data points from ECE2031 server
  response = urllib2.urlopen(serverUrl)
  html =
  xPoints = []  # list for robot x points
  yPoints = []  # list for robot y points 
  xDesPoints = [] # list for destination x points
  yDesPoints = [] # list for destination y ponins
  # this line should be changed for starting trigger.
  strparse = "<p>";
  html = html.split(strparse)[-1];
  strparse = "</p>";
  html = html.split(strparse)[0];
  for line in html.split('<br>'):
    if line is not "":
      points = line.split(',')
      print points
      x = float(points[0])
      y = float(points[1])
  print "Robot Path"
  for i in range(1, len(xPoints)):
    print '(' + str(xPoints[i])[:5] + ',' + str(yPoints[i])[:5] + ')'
  return xPoints, yPoints

def printTerminal():
  plt.plot([-16, 16], [-16,-16], 'k-')
  plt.plot([-16, 16], [0,0], 'k-')
  plt.plot([-16, 16], [16,16], 'k-')
  plt.plot([0, 0], [-16,16], 'k-')
  plt.xlabel("X axis -- inch")
  plt.ylabel("Y axis -- inch")
  plt.title("Terminal Outline") 
  axes = plt.gca()
def printResult(dataX, dataY):
    This module will initialize the point on the canvas
  plt.plot([-16, 16], [-16,-16], 'k-')
  plt.plot([-16, 16], [0,0], 'k-')
  plt.plot([-16, 16], [16,16], 'k-')
  plt.plot([0, 0], [-16,16], 'k-')
  plt.plot(dataX, dataY, 'ko', label = "Robot Log")
  plt.plot(dataX, dataY, 'r--', label = "Robot Path")
  plt.plot(0,0, 'gs', label = "Starting Point")
  plt.plot(dataX[-1],dataY[-1], 'bo', label = "Current Location")
if __name__ == "__main__":
    main funciton for parseWeb
  fName = "points.txt"
  ans = ""
  gl_dataX = [8];
  gl_dataY = [8];
  cmdlist = {};
  cmdlist['B'] = "b1b1d1b1b1" # cmdlist, it can be extended 
  cmdlist['b'] = ""
  while(ans != "q"):
    dataX, dataY= parseWeb() 
    if dataX and not gl_dataX[-1] == dataX[-1] and not gl_dataY[-1] == dataY[-1]:
      gl_dataX = [8];
      gl_dataY = [8];
    printResult(gl_dataX, gl_dataY)
    plt.xlabel("X axis -- Feet")
    plt.ylabel("Y axis -- Feet")
    plt.title("Simulation Result") 
    axes = plt.gca()
    print "You have 2 seconds to answer!"
    i, o, e = [sys.stdin], [], [], 2)
    # 2 second respond time
    if (i):
       ans =  sys.stdin.readline().strip()
       print "You said " + ans
       print "You said nothing!"
    if ans == "s":
    if ans is not "":
      print "send  " + cmdlist[ans]
      urllib2.urlopen(serverUrl,"CMDSTART" + cmdlist[ans] + "CMDEND")
      # send the post data to wifi module
    ans = ""


Demo Video

Further Enhancement


  • Tweaking python scripts for tracking multiple vehicles
  • Finding a way to overcome the http buffer limit. For the http server there is a buffer limit, finding a more efficient way to compress data will allow the plot to be more precise.


/media/uploads/boalinlai/img_20161212_100553.jpg /media/uploads/boalinlai/ece.png


Please log in to post comments.