Skip to content
Snippets Groups Projects
Commit f3150fad authored by Jessica Dreyer's avatar Jessica Dreyer
Browse files

Corrected Odometrie

parent 6b892b92
No related branches found
No related tags found
1 merge request!1Development
......@@ -76,13 +76,16 @@ class Driving_Analyser:
"""
def calculate_odometrie_continues (self, w, v, time_delta):
if w != 0 or v != 0:
if w != 0: #or v != 0:
theta = self.theta_old + (w * time_delta)
if w < 0:
y = self.y_old + (v * (-np.cos(theta) / w - 1))
x = self.x_old + (v * ((np.sin(theta) - np.sin(self.theta_old)) / w))
y = self.y_old + (v * (-(np.cos(theta) - np.cos(self.theta_old)) / w))
else:
y = self.y_old + (v * (-np.cos(theta) / w + 1))
x = self.x_old + (v * (np.sin(theta) / w))
theta = self.theta_old
x = self.x_old + (v * np.cos(self.theta_old) * time_delta)
y = self.y_old + (v * np.sin(self.theta_old) * time_delta)
self.theta_old = theta
self.y_old = round(y, 5)
......@@ -95,12 +98,16 @@ class Driving_Analyser:
# The calculation of the position depending on the speed, rotationspeed and the time.span.
"""
def calculate_odometrie_delta (self, w, v, time_delta):
if w != 0:
theta_delta = (w * time_delta)
if w < 0:
y_delta = (v * (-np.cos(theta_delta) / w - 1))
x_delta = (v * (np.sin(theta_delta) / w))
y_delta = (v * (-(np.cos(theta_delta) + cos(0)) / w))
else:
y_delta = (v * (-np.cos(theta_delta) / w + 1))
x_delta = (v * (np.sin(w * time_delta) / w))
theta_delta = 0
x_delta = v * (np.cos(0))
y_delta = v * (np.sin(0))
return (x_delta, y_delta, theta_delta)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment