-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver-teleop.py
43 lines (34 loc) · 1.02 KB
/
server-teleop.py
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
#!usr/bin/python
import time
import math
import cv2
import numpy as np
#import sys
import pygame
import PiBot as PB
# write your command to initialise robot here
pygame.init()
pygame.display.set_mode((10,10))
try:
print("TELEOP")
while True:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
print event.type
if event.key == pygame.K_UP:
print("FORWARD")
# write your command here
if event.key == pygame.K_DOWN:
print("BACKWARD")
# write your command here
if event.key == pygame.K_LEFT:
print "LEFT"
# write your command here
if event.key == pygame.K_RIGHT:
print "RIGHT"
# write your command here
if event.type == pygame.KEYUP:
print "Done"
# stop the robot on Key up
except KeyboardInterrupt:
pb.stop()