-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreceiver.py
More file actions
executable file
·44 lines (33 loc) · 949 Bytes
/
Copy pathreceiver.py
File metadata and controls
executable file
·44 lines (33 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# @author Nathan Murray
# @url mason.gmu.edu/~blane3/theforce/becomeijedi.html
# @lastupdated 2014-04-28
# @version 1.0.0
# @comments receiver program
#For python 2.7
import urllib
import socket
import create
socket.setdefaulttimeout(0.5)
prevSpeed = 0
prevTurnSpeed = 0
#CREATE THE ROBOT HERE
robot=create.Create(3)
robot.toFullMode()
while True:
try:
f = urllib.urlopen('http://nathanspc.noip.me')
speed = f.info().getheader('Speed')
speed = int(speed)
turnSpeed = f.info().getheader('TurnSpeed')
turnSpeed = int(turnSpeed)
if speed != prevSpeed or turnSpeed != prevTurnSpeed:
#ENTER ROBOT MOVE INFO HERE
robot.go(speed,turnSpeed)
print('Move speed: ' + str(speed) + ' Turn speed: ' + str(turnSpeed))
prevSpeed = speed
prevTurnSpeed = turnSpeed
except IOError:
robot.go(0,0)
prevSpeed = 0
prevTurnSpeed = 0
print('Timeout, reconnecting')