Просмотр исходного кода

adjust batch size to minimize motor noise

Tuan Nguyen 1 год назад
Родитель
Сommit
75530e6790
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      app.py

+ 2 - 2
app.py

@@ -69,7 +69,7 @@ def parse_theta_rho_file(file_path):
 def send_coordinate_batch(ser, coordinates):
     """Send a batch of theta-rho pairs to the Arduino."""
     # print("Sending batch:", coordinates)
-    batch_str = ";".join(f"{theta:.2f},{rho:.2f}" for theta, rho in coordinates) + ";\n"
+    batch_str = ";".join(f"{theta:.3f},{rho:.3f}" for theta, rho in coordinates) + ";\n"
     ser.write(batch_str.encode())
 
 def send_command(command):
@@ -98,7 +98,7 @@ def run_theta_rho_file(file_path):
         return
 
     # Optimize batch size for smoother execution
-    batch_size = 10  # Smaller batches may smooth movement further
+    batch_size = 1  # Smaller batches may smooth movement further
     for i in range(0, len(coordinates), batch_size):
         batch = coordinates[i:i + batch_size]
         if i == 0: