From 2c90bc7db6dfd47faa909d4b6939ecbfa6ca12a4 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Mon, 17 Apr 2017 19:35:56 +0000 Subject: [PATCH] CM und Degree-Steurung implementiert --- __pycache__/motion.cpython-36.pyc | Bin 1573 -> 1846 bytes manual_controll.py | 13 +++++-------- motion.py | 12 +++++++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/__pycache__/motion.cpython-36.pyc b/__pycache__/motion.cpython-36.pyc index eddef263738036f4a9c6f16259f7e85530aed04f..c55e4cb00caed73c5ec9a1747bec96ce9792ae96 100644 GIT binary patch delta 825 zcma)4J4*vW5Z<{*Jnt?siSdyH?IIoo73^#b=rz8OsGw1>@Gdb?BWz9ti3HR?5Vlfl z3;%$vSXJnIz$Fm9D@uF29lM;Eh@O}4BxcX8FtFT3k*-hq}@ z^AC&nj7P;OY*+?Eg9xsWc!Bb0AHMQv8)E3SjNpVRim~sFmRcQ0dY99myd(;adkq5>?uT}(N6kv_|$R; z|1YTVkBZ9sSR7BHE><*v8y_T)6@|(BTT#gKOWgN6i!$j4&r2$UDecNcRv!UNEa;i7 vI7$7=)3p5bkK}oZAWiT)ZqlQf;~E0ZW{r-pU%H{Tmm!|?nP_L0utKSCQMHb? delta 609 zcmZ`$%Syvg5WSP6@irteeORd$H>JgZsNhE2T6fw-eV}z|(uYb5HxWS!Lc0?;Pb>ht=(*ejx^Qt5=rBx+4}gZjC@qj zO5^MQQBpl84Xv4D#%n%Sw>Bk4FDMC z8dW^9Osxv?vfV;-6C#UTED)#!76DCimH6lDy5~2A?@t>?<0FGysKm7b=7E90fP>{0}".format(input)) - doIt(input); + modus=getch.getch(); + print("Erinaco>>{0}".format(modus)) + doIt(modus); except KeyboardInterrupt: print("Verlasse Erinaco...") core.__del__(); diff --git a/motion.py b/motion.py index 598645d..3c96519 100644 --- a/motion.py +++ b/motion.py @@ -10,6 +10,7 @@ class Motion(object): self.motorRight=MOTOR(23,18,1) #Initialisierung des linken Motors self.motorLeft=MOTOR(24,25,0) #Initialisierung des rechten Motors self.FULLTURNTIME=4.5; #Dauer welche fuer eine 360 Grad wendebenoetigt wird in Sekunden + self.SEKPERMETER=6.9; def turnLeft(self): self.motorRight.forward() self.motorLeft.backward() @@ -25,9 +26,18 @@ class Motion(object): def stop(self): self.motorRight.stop() self.motorLeft.stop() + def runCm(self,cm): + if cm<0: + self.backward(); + cm=cm*-1; + else: + self.forward(); + sleep((self.SEKPERMETER/100)*cm); + self.stop(); def turnDegree(self,degree): if degree<0: - self.turnLeft(); + self.turnLeft(); + degree=degree*-1; else: self.turnRight(); sleep((self.FULLTURNTIME/360)*degree);