Selaa lähdekoodia

adjust batch size to minimize motor noise

Tuan Nguyen 1 vuosi sitten
vanhempi
sitoutus
75530e6790
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  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):
 def send_coordinate_batch(ser, coordinates):
     """Send a batch of theta-rho pairs to the Arduino."""
     """Send a batch of theta-rho pairs to the Arduino."""
     # print("Sending batch:", coordinates)
     # 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())
     ser.write(batch_str.encode())
 
 
 def send_command(command):
 def send_command(command):
@@ -98,7 +98,7 @@ def run_theta_rho_file(file_path):
         return
         return
 
 
     # Optimize batch size for smoother execution
     # 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):
     for i in range(0, len(coordinates), batch_size):
         batch = coordinates[i:i + batch_size]
         batch = coordinates[i:i + batch_size]
         if i == 0:
         if i == 0: