Example #1
0
import sys

from geopy import distance
import threading
from imProc import imProcessing
from capturing import ImageCap
from cmds import calculateReading, issueCommands
from globals import pixelStrip, startFrom, logInitial
from gps import GPS

if __name__ == "__main__":


	gps = GPS(logging=False)

	while gps.getCoords() == (0,0):
		print("Awaiting gps lock.")
		#time.sleep(0.2)
		gps.getGPS(force=1)

	startingPos = gps.getCoords() #so we know to stop 15m afterwards

	issueCommands(0,0) #connect to car

	distanceAway = 0
	while distanceAway < 12: #go forward 15m
		distanceAway = distance.distance(gps.getGPS(force=1), startingPos).m
		print("Distance away from destination: ", distanceAway)
		issueCommands(1,100) #go straight

	issueCommands(0,0)
from cmds import issueCommands
from gps import GPS
import math

if __name__ == "__main__":

    gps = GPS(logging=False)
    gps.getGPS()
    while gps.getCoords() == (0, 0):
        print("Awaiting gps lock.")

    startingPos = gps.getCoords()

    issueCommands(0, 0)

    distanceAway = 0
    while distanceAway < 0:  #go forward 15m
        gps.getGPS()
        distanceAway = (distance.distance(gps.getCoords(), startingPos)).m
        print("Distance away from destination: ", distanceAway)
        issueCommands(0, 85)

    issueCommands(0, 0)  #connect to car

    startLeft = issueCommands.car.get_left_pulse()  #should be 0
    startRight = issueCommands.car.get_right_pulse()  #should be 0
    carWidth = 1.17  #in meters
    fullCircleDistance = 2 * math.pi * carWidth

    tyreCirc = math.pi * 0.58
    fullCircleRotations = fullCircleDistance / tyreCirc