From 473ec178a6e1b3735282644366fea7328364906f Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 16 Apr 2017 20:27:42 +0000 Subject: [PATCH] Zwischencommit --- .gitignore | 3 +++ autopilot.py | 4 ++-- manual_controll.py | 42 +++++++++++++++++++++++++----------------- sensoren/camera.sh | 3 ++- 4 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a295fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/autopilot.cpython-36.pyc +__pycache__/vero.cpython-36.pyc +sensoren/__pycache__/ diff --git a/autopilot.py b/autopilot.py index a071026..2afa821 100644 --- a/autopilot.py +++ b/autopilot.py @@ -62,8 +62,8 @@ class Autopilot(CORE,THREAD): def testForward(self): ultraschallMitte=self.ultraschallMitte.getValue(); if(ultraschallMitte<=self.ultraschalminimum - or self.ultraschallRechts.getValue()<=self.ultraschalminimum - or self.ultraschallLinks.getValue()<=self.ultraschalminimum + #or self.ultraschallRechts.getValue()<=self.ultraschalminimum + #or self.ultraschallLinks.getValue()<=self.ultraschalminimum or self.infarotMitteLinks.getValue() or self.infarotMitteRechts.getValue()): self.stop(); diff --git a/manual_controll.py b/manual_controll.py index 258d86b..c460861 100644 --- a/manual_controll.py +++ b/manual_controll.py @@ -20,24 +20,32 @@ def help(): print("Halbautomatisch: w") print("Manuell: e") def autopilot(): - core=AUTOPILOT() - #core.start(); - while True: - try: - core.forward(); - except ForwardMoveException: - if randint(0,1): - core.backward(); - else: - if randint(0,1): - core.turnLeft(); + try: + core=AUTOPILOT() + #core.start(); + while True: + try: + core.printValues(); + if core.moveStatus!=1: + core.forward(); else: - core.turnRight(); - except LeftMoveException: - core.turnLeft(); - except RightMoveException: - core.turnRight(); - sleep(0.5); + core.statusTest(); + except ForwardMoveException: + if randint(0,1): + core.backward(); + else: + if randint(0,1): + core.turnLeft(); + else: + core.turnRight(); + except LeftMoveException: + core.turnLeft(); + except RightMoveException: + core.turnRight(); + sleep(1); + except KeyboardInterrupt: + print("Verlasse Autopilot...") + #core=CORE(); def doIt(order): switcher = { 'w': lambda: core.forward(), diff --git a/sensoren/camera.sh b/sensoren/camera.sh index 9708fd6..ceb2281 100644 --- a/sensoren/camera.sh +++ b/sensoren/camera.sh @@ -1,6 +1,7 @@ #!/bin/bash #Streamt ein Video auf Vaio -/opt/vc/bin/raspivid --hflip --vflip -t 0 -o - | nc 192.168.178.30 5001 +#/opt/vc/bin/raspivid --hflip --vflip -t 0 -o - | nc 192.168.178.30 5001 #Auf Vaio muss # nc -l -p 5001 | mplayer -fps 31 -cache 1024 - # ausgefuehert werden +/opt/vc/bin/raspivid -w 640 -h 480 --hflip --vflip -t 0 -o - | nc 192.168.178.30 5001