소스 검색

adjust parameters

Tuan Nguyen 1 년 전
부모
커밋
79081034c2
2개의 변경된 파일5개의 추가작업 그리고 8개의 파일을 삭제
  1. 3 6
      arduino_code/arduino_code.ino
  2. 2 2
      theta_rho_app.py

+ 3 - 6
arduino_code/arduino_code.ino

@@ -30,10 +30,10 @@ bool batchComplete = false;
 void setup() {
     // Set maximum speed and acceleration
     rotStepper.setMaxSpeed(2000);  // Adjust as needed
-    rotStepper.setAcceleration(1);  // Adjust as needed
+    rotStepper.setAcceleration(500);  // Adjust as needed
 
     inOutStepper.setMaxSpeed(2000);  // Adjust as needed
-    inOutStepper.setAcceleration(1);  // Adjust as needed
+    inOutStepper.setAcceleration(500);  // Adjust as needed
     // inOutStepper.setPinsInverted(true, false, false);
 
     // Add steppers to MultiStepper
@@ -108,7 +108,7 @@ void homing() {
     inOutStepper.setSpeed(-5000);  // Adjust speed for homing
     while (true) {
         inOutStepper.runSpeed();
-        if (inOutStepper.currentPosition() <= -5760 * 1.1) {  // Adjust distance for homing
+        if (inOutStepper.currentPosition() <= -inOut_total_steps * 1.1) {  // Adjust distance for homing
             break;
         }
     }
@@ -135,8 +135,5 @@ void movePolar(float theta, float rho) {
 
     // Move both motors synchronously
     multiStepper.moveTo(targetPositions);
-    unsigned long lastStepTime = 0;
-    const unsigned long stepInterval = 10;  // 10 ms between checks
-
     multiStepper.runSpeedToPosition();  // Blocking call
 }

+ 2 - 2
theta_rho_app.py

@@ -111,13 +111,13 @@ def run_theta_rho_file(file_path):
         return
 
     # Interpolate paths between points with fine resolution
-    step_size = 0.005  # Smaller values create finer steps for smoother movement
+    step_size = 0.01  # Smaller values create finer steps for smoother movement
     interpolated_coordinates = []
     for i in range(len(coordinates) - 1):
         interpolated_coordinates.extend(interpolate_path(coordinates[i], coordinates[i + 1], step_size=step_size))
 
     # Optimize batch size for smoother execution
-    batch_size = 20  # Smaller batches may smooth movement further
+    batch_size = 8  # Smaller batches may smooth movement further
     for i in range(0, len(interpolated_coordinates), batch_size):
         if stop_requested:
             print("Execution stopped by user.")