Exemplo n.º 1
0
gps_pos = GPSServerConnection()
robot = SerialCommands('/dev/ttyAMA0',115200)

pos_x=[]
pos_y=[]

if __name__ == '__main__':
		
	pos,t = gps_pos.getPosition(1)
	pos_x.append(pos[0])
	pos_y.append(pos[1])
	
	robot.startLineFollowing(20)

	
	for i in range(1,40):
		
		pos_x.append(pos_x[i-1]+ (20*0.465*0.2)*0.2516)
		pos_y.append(pos_y[i-1])

		
		time.sleep(0.2)
		
	print pos_x[39]
	
	robot.init()
	print gps_pos.getPosition(1)
		
			

Exemplo n.º 2
0
#!/usr/bin/env python
# -*- coding: utf-8 


import struct, time
import kbhit
from RobotCommunication import SerialCommands

robot = SerialCommands('/dev/ttyAMA0',115200)
kb = kbhit.KBHit()

print robot.init()



if __name__ == '__main__':
	
	robot.startLineFollowing(20) ###start line following with speed 1-127
	
	
	while 1: 
		
		if kb.kbhit():  ### check if the key is pressed
			key = kb.getch()
			if key == 'r':   ##if pressed "r" go from left to right lane
				robot.laneChange(1)
			if key == 'l':   ##if pressed "l" go from right to left lane
				robot.laneChange(-1)
			if key == 's': ## if pressed "s" stop the robot
				robot.init()
Exemplo n.º 3
0
from RobotCommunication import SerialCommands
import numpy as np

import time

gps_pos = GPSServerConnection()
robot = SerialCommands('/dev/ttyAMA0', 115200)

pos_x = []
pos_y = []

if __name__ == '__main__':

    pos, t = gps_pos.getPosition(1)
    pos_x.append(pos[0])
    pos_y.append(pos[1])

    robot.startLineFollowing(20)

    for i in range(1, 40):

        pos_x.append(pos_x[i - 1] + (20 * 0.465 * 0.2) * 0.2516)
        pos_y.append(pos_y[i - 1])

        time.sleep(0.2)

    print pos_x[39]

    robot.init()
    print gps_pos.getPosition(1)