diff --git a/driving.py b/driving.py index b0ce6e0ddc3b0620fc185e2cce237cf0600c604d..58f88b2169fa17d9d5d8bb7235c61ab2d0fb19ab 100644 --- a/driving.py +++ b/driving.py @@ -78,12 +78,16 @@ class Driving_Analyser: if w != 0 or v != 0: theta = self.theta_old + (w * time_delta) - y = self.y_old + (v * (-np.cos(theta) / w)) + #y = self.y_old + (v * ((-np.cos(theta) / w) + 1)) + if w < 0: + y = self.y_old + (v * (-np.cos(theta) / w - 1)) + else: + y = self.y_old + (v * (-np.cos(theta) / w + 1)) x = self.x_old + (v * (np.sin(theta) / w)) self.theta_old = theta - self.y_old = y - self.x_old = x + self.y_old = round(y, 5) + self.x_old = round(x, 5) return (self.x_old, self.y_old, self.theta_old)