diff --git a/main.py b/main.py
index 541ca50..fcb679a 100644
--- a/main.py
+++ b/main.py
@@ -213,7 +213,7 @@ def set_speed(self, speed):
:param speed: The speed throughout the turn
:return: modifies acceleration
'''
- self.current_params.max_speed = speed
+ self.current_params.speed = speed
acceleration = self.path.get_turn_acceleration(self.current_profile, self.current_params)
self.set_safely(self.ui.accelerationSpinBox, int(acceleration))
self.re_calculate()
@@ -255,7 +255,7 @@ def set_acceleration(self, acceleration):
self.current_params.acceleration = acceleration
radius = self.ui.radiusSpinBox.value()
speed = math.sqrt(acceleration * radius)
- self.current_params.max_speed = speed
+ self.current_params.speed = speed
self.set_safely(self.ui.turnSpeedSpinBox, int(speed))
self.re_calculate()
@@ -339,8 +339,8 @@ def show_summary(self):
self.ui.textEdit.append(f" Wheel Accel'n: {wheel_acc:5.0f} mm/s/s")
self.ui.textEdit.append(f" Max alpha: {max_alpha:5.0f} deg/s/s")
self.ui.textEdit.append(f" Max omega: {self.path.get_max_omega():5.0f} deg/s")
- self.ui.textEdit.append(f" Exit X: {end_x:5.1f} mm")
- self.ui.textEdit.append(f" Exit Y: {end_y:5.1f} mm")
+ self.ui.textEdit.append(f"Profile Exit X: {end_x:5.1f} mm")
+ self.ui.textEdit.append(f"Profile Exit Y: {end_y:5.1f} mm")
self.ui.textEdit.append(f" Overshoot X: {slip_comp_x:5.1f} mm")
self.ui.textEdit.append(f" Undershoot Y: {slip_comp_y:5.1f} mm")
self.ui.textEdit.append(f" Exit Speed: {self.path.trajectory.speed:5.0f} mm/s")
@@ -365,7 +365,7 @@ def plot_data(self):
lot of that is just clearing the axes
'''
now = perf_counter()
- axes = self.ui.mpl_widget.axes
+ axes = self.ui.pg_widget.axes
title_style = {'color': 'cyan', 'size': '12px'}
interval = self.path.trajectory.delta_t
path_time = self.path.trajectory.time
diff --git a/path.py b/path.py
index a558a5d..0783f36 100644
--- a/path.py
+++ b/path.py
@@ -164,7 +164,7 @@ def calculate(self, profile_type: ProfileType, params: TurnParameters, startx, s
else:
profile = Trapezoid()
self.trajectory.set_profiler(profile)
- params.speed = params.max_speed
+ # params.speed = params.max_speed
self.trajectory.set_params(params)
self.trajectory.set_start_xy(startx,starty)
self.trajectory.calculate()
@@ -176,12 +176,12 @@ def calculate(self, profile_type: ProfileType, params: TurnParameters, startx, s
def get_turn_acceleration(self, profile_type: ProfileType, params: TurnParameters):
acc = 0
if profile_type == ProfileType.TRAPEZOID:
- acc = params.max_speed * params.max_speed / params.arc_radius
+ acc = params.speed * params.speed / params.arc_radius
elif profile_type == ProfileType.QUADRATIC:
- acc = params.max_speed * params.max_speed / params.arc_radius
+ acc = params.speed * params.speed / params.arc_radius
elif profile_type == ProfileType.SINUSOID:
- acc = params.max_speed * params.max_speed / params.arc_radius
+ acc = params.speed * params.speed / params.arc_radius
elif profile_type == ProfileType.CUBIC:
- acc = 6 * params.max_speed * params.max_speed * math.radians(params.angle) / 4 / params.cubic_length
+ acc = 6 * params.speed * params.speed * math.radians(params.angle) / 4 / params.cubic_length
return acc
diff --git a/profiler.py b/profiler.py
index 99a86d5..381699e 100644
--- a/profiler.py
+++ b/profiler.py
@@ -40,10 +40,10 @@ def __init__(self):
def setup(self, params : TurnParameters):
self.params = params
- self.arc_omega = np.degrees(params.max_speed / params.arc_radius)
- self.transition_angle = params.delta * self.arc_omega / (2.0 * params.max_speed)
+ self.arc_omega = np.degrees(params.speed / params.arc_radius)
+ self.transition_angle = params.delta * self.arc_omega / (2.0 * params.speed)
self.arc_angle = params.angle - 2 * self.transition_angle
- self.arc_length = params.max_speed * self.arc_angle / self.arc_omega
+ self.arc_length = params.speed * self.arc_angle / self.arc_omega
self.length = 2 * params.delta + self.arc_length
def get_omega(self,p,speed):
@@ -67,10 +67,10 @@ def __init__(self):
def setup(self, params : TurnParameters):
self.params = params
- self.arc_omega = np.degrees(params.max_speed / params.radius)
- self.transition_angle = params.delta * self.arc_omega / (3.0 * params.max_speed)
+ self.arc_omega = np.degrees(params.speed / params.radius)
+ self.transition_angle = params.delta * self.arc_omega / (3.0 * params.speed)
self.arc_angle = params.angle - 2 * self.transition_angle
- self.arc_length = params.max_speed * self.arc_angle / self.arc_omega
+ self.arc_length = params.speed * self.arc_angle / self.arc_omega
self.length = 2 * params.delta + self.arc_length
def get_omega(self,p,speed):
@@ -94,10 +94,10 @@ def __init__(self):
def setup(self, params : TurnParameters):
self.params = params
- self.arc_omega = np.degrees(params.max_speed / params.radius)
- self.transition_angle = params.delta * self.arc_omega / (np.pi * params.max_speed)
+ self.arc_omega = np.degrees(params.speed / params.radius)
+ self.transition_angle = params.delta * self.arc_omega / (np.pi * params.speed)
self.arc_angle = params.angle - 2 * self.transition_angle
- self.arc_length = params.max_speed * self.arc_angle / self.arc_omega
+ self.arc_length = params.speed * self.arc_angle / self.arc_omega
self.length = 2 * params.delta + self.arc_length
def get_omega(self,p,speed):
@@ -123,7 +123,7 @@ def __init__(self):
def setup(self, params : TurnParameters):
self.params = params
radius = 4.0*params.delta/(np.pi*np.radians(params.angle))
- self.arc_omega = np.degrees(params.max_speed / radius)
+ self.arc_omega = np.degrees(params.speed / radius)
self.length = 2 * params.delta
diff --git a/profilers.py b/profilers.py
index 5f73e54..e87241c 100644
--- a/profilers.py
+++ b/profilers.py
@@ -105,7 +105,6 @@ def setup(self, params : TurnParameters):
self.arc_angle = params.angle - 2 * self.transition_angle
self.arc_length = self.params.speed * self.arc_angle / self.arc_omega
self.length = 2 * params.delta + self.arc_length
- print(self.arc_length)
def get_omega(self,p):
phase = 1
diff --git a/pyturnprofile.ui b/pyturnprofile.ui
index 0cbfd7b..2a34a27 100644
--- a/pyturnprofile.ui
+++ b/pyturnprofile.ui
@@ -284,7 +284,7 @@ p, li { white-space: pre-wrap; }
-
-
+
@@ -472,9 +472,9 @@ p, li { white-space: pre-wrap; }
-
-
+
- Slip
+ Grip
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -653,7 +653,7 @@ p, li { white-space: pre-wrap; }
Turn Summary
-
+
10
diff --git a/trajectory.py b/trajectory.py
index d3e3330..1f350f1 100644
--- a/trajectory.py
+++ b/trajectory.py
@@ -6,7 +6,7 @@
# File Created: Thursday, 5th January 2023 2:10:17 pm
# Author: Peter Harrison
# -----
-# Last Modified: Saturday, 7th January 2023 11:05:43 pm
+# Last Modified: Sunday, 8th January 2023 3:24:48 pm
# -----
# Copyright 2022 - 2023 Peter Harrison, Micromouseonline
# -----
@@ -160,8 +160,6 @@ def beta_dot(omega,beta, speed):
b_dot = -(np.radians(omega) + self.k_grip * np.radians(beta) / speed)
return np.degrees(b_dot)
- self.theta_actual[0] = self.start_angle
- # print(self.speed, self.k_grip, self.k_grip/self.speed)
for i in range(len(self.time)):
if i > 0:
omega = self.omega_ideal[i-1]
@@ -173,6 +171,7 @@ def beta_dot(omega,beta, speed):
x = self.start_x
y = self.start_y
+ self.theta_actual[0] = self.theta_ideal[0]
for i,angle in enumerate(self.theta_actual):
self.x_actual[i] = x
self.y_actual[i] = y
diff --git a/ui_pyturnprofile.py b/ui_pyturnprofile.py
index a3a4426..83a17c6 100644
--- a/ui_pyturnprofile.py
+++ b/ui_pyturnprofile.py
@@ -244,9 +244,9 @@ def setupUi(self, MainWindow):
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(10, 460, 131, 16))
self.label.setObjectName("label")
- self.mpl_widget = PGWidget(self.centralwidget)
- self.mpl_widget.setGeometry(QtCore.QRect(10, 30, 401, 401))
- self.mpl_widget.setObjectName("mpl_widget")
+ self.pg_widget = PGWidget(self.centralwidget)
+ self.pg_widget.setGeometry(QtCore.QRect(10, 30, 401, 401))
+ self.pg_widget.setObjectName("pg_widget")
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)