Post-Merge Cleanup

pull/1/head
Trivernis 6 years ago
parent 66379ea24d
commit 5fa2bb7fca

@ -2,7 +2,7 @@ import os
import pygame
class Joystick():
class Joystick:
def __init__(self, navigator, light, configuration, camera):
# joystick
pygame.joystick.init()

@ -1,6 +1,7 @@
import pygame, pygame.camera
import picamera
import picamera.array
import pygame
import pygame.camera
from pygame import *
@ -13,6 +14,7 @@ class Screen:
"""The Screen for the Terminal"""
def __init__(self, size=(100, 100), title="Screen"):
self.fullscreen = True
pygame.display.init()
self.size = size
self.screen = pygame.display.set_mode(self.size)
@ -29,7 +31,6 @@ class Screen:
displayinfo = pygame.display.Info()
fullsize = (displayinfo.current_w, displayinfo.current_h)
pygame.display.set_mode(fullsize, FULLSCREEN | DOUBLEBUF)
self.fullscreen = True
class List(pygame.sprite.Sprite):

@ -24,7 +24,7 @@ def read_word(reg):
def read_word_2c(reg):
val = read_word(reg)
if (val >= 0x8000):
if val >= 0x8000:
return -((65535 - val) + 1)
else:
return val

@ -4,7 +4,7 @@ import RPi.GPIO as GPIO
import time
class Navigator():
class Navigator:
"""Forward Motor with relais, Steering with servo"""
def __init__(self, mrelaispin):

@ -5,10 +5,13 @@ GPIO.setmode(GPIO.BOARD)
class Sensor(object):
def init(self, TRIG, ECHO):
def __init__(self):
self.TRIGGER = TRIG
self.ECHO = ECHO
self.lastValues = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
self.lastValues = self.lastValues[1:]
def init(self, TRIG, ECHO):
GPIO.setup(self.TRIGGER, GPIO.OUT)
GPIO.setup(self.ECHO, GPIO.IN)
GPIO.output(self.TRIGGER, False)
@ -36,7 +39,6 @@ class Sensor(object):
distance = pulse_duration * 17150
distance = round(distance, 2)
self.lastValues.append(distance)
self.lastValues = self.lastValues[1:]
distance = round((sum(self.lastValues)) / (len(self.lastValues)), 2)
# print(self.lastValues)
# print("Distance: {}".format(distance))

@ -129,10 +129,10 @@ if __name__ == '__main__':
while True:
try:
start = time.time()
while (time.time() < start + 10):
while time.time() < start + 10:
forward(pins)
start = time.time()
while (time.time() < start + 10):
while time.time() < start + 10:
backward(pins)
except KeyboardInterrupt:
break

Loading…
Cancel
Save