From 172e36838023f4402eadbf98b88e412a7b2b5e07 Mon Sep 17 00:00:00 2001 From: haselnussbier Date: Fri, 23 Mar 2018 19:09:49 +0100 Subject: [PATCH] reapplied commit: 0124e57 --- src/move.py | 2 -- src/odometry.py | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/move.py b/src/move.py index c2352c9..d102a7a 100644 --- a/src/move.py +++ b/src/move.py @@ -59,7 +59,6 @@ class Move: ''' Function to correct errors should the robot wander astray ''' - # Probably redundant because aligning can be done while scanning other paths def _aligntoedge(self): pass @@ -88,6 +87,5 @@ class Move: self._camera.getcolor() if(not isknownstation): print(self._odometry.degree(self._wheel_l.getmovement(), self._wheel_r.getmovement(), 0)) - # pass # run odometry stuff here self._wheel_l.stop() self._wheel_r.stop() diff --git a/src/odometry.py b/src/odometry.py index a2fac38..35d266b 100644 --- a/src/odometry.py +++ b/src/odometry.py @@ -4,6 +4,7 @@ import time from planet import Direction +import math ''' Documentation: @@ -45,8 +46,8 @@ class Odometry: elif self.alpha % (2 * self._pi) >= self._pi * 0.25 and self.alpha % (2 * self._pi) < self._pi * 0.5 or self.alpha % (2 * self._pi) >= self._pi * 0.5 and self.alpha % (2 * self._pi) < self._pi * 0.75: return(Direction.EAST, "Distance = ", self.distance) - elif self.alpha % (2 * self._pi)>=self._pi * 0.75 and self.alpha % (2* self._pi)< self._pi or self.alpha % (2 * self._pi) >=self._pi and self.alpha < self.alpha * 5/4 pi : - return(Direction.SOUTH,"Distance = ",self.distance) + elif self.alpha % (2 * self._pi) >= self._pi * 0.75 and self.alpha % (2 * self._pi) < self._pi or self.alpha % (2 * self._pi) >= self._pi and self.alpha % (2 * self._pi) < 5 / 4 * self._pi: + return(Direction.SOUTH, "Distance = ", self.distance) else: return(Direction.WEST, "Distance = ", self.distance)