From 3a88aac74a89603ab80bc5a1f9e3a000be660ae8 Mon Sep 17 00:00:00 2001 From: jenoack Date: Fri, 17 Mar 2023 09:27:57 +0100 Subject: [PATCH] updated params and speed settings --- vscode/Unendlichkeitsmaschine/include/main.hpp | 8 ++++---- vscode/Unendlichkeitsmaschine/src/main.cpp | 16 +++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/vscode/Unendlichkeitsmaschine/include/main.hpp b/vscode/Unendlichkeitsmaschine/include/main.hpp index 07bfb9f..90d96aa 100644 --- a/vscode/Unendlichkeitsmaschine/include/main.hpp +++ b/vscode/Unendlichkeitsmaschine/include/main.hpp @@ -100,10 +100,10 @@ const uint8_t HALL6_PIN = 26; const uint8_t HALL7_PIN = 27; const uint8_t HALL8_PIN = 14; -const uint16_t MIN_SPEED = 600; -const uint16_t MAX_SPEED = 1200; -const uint8_t MAX_ESC_SPEED = 60; -const uint8_t MIN_ESC_SPEED = 37; +const uint16_t MIN_SPEED = 500; +const uint16_t MAX_SPEED = 3000; +const uint8_t MAX_ESC_SPEED = 100; +const uint8_t MIN_ESC_SPEED = 36; const uint16_t MAX_POTI_VALUE = 4095; const uint16_t JITTER_POTI_PERCENT = 10; diff --git a/vscode/Unendlichkeitsmaschine/src/main.cpp b/vscode/Unendlichkeitsmaschine/src/main.cpp index ccb3f68..12bfcda 100644 --- a/vscode/Unendlichkeitsmaschine/src/main.cpp +++ b/vscode/Unendlichkeitsmaschine/src/main.cpp @@ -19,9 +19,11 @@ volatile double goal_speed = 0; volatile double current_speed = 0; volatile double err = 0; volatile double output = 0.0; -double kp = 0.005; -double ki = 0.0008; -double kd = 0.0001; +double kp = 1;//0.005; +double ki = 1000;//0.0008; +double kd = 5;//0.0001; + +//bei 2000 als speed: values: kp=0.020000 ki=0.005000 kd=0.000100 void ISR_HALL1(); void ISR_HALL2(); @@ -320,15 +322,19 @@ void get_serial_cmd() ki = command.substring(command.indexOf("=")+1).toDouble(); Serial.printf("Set ki to %f\n", ki); } - else if(command.startsWith("speed=")){ ser_speed = command.substring(command.indexOf("=")+1).toDouble(); - Serial.printf("Set speed to %f\n", speed); + Serial.printf("Set speed to %f\n", ser_speed); } else if(command.startsWith("kd=")){ kd = command.substring(command.indexOf("=")+1).toDouble(); Serial.printf("Set kd to %f\n", kd); } + else if(command.startsWith("esc=")){ + ser_esc_output = command.substring(command.indexOf("=")+1).toDouble(); + Serial.printf("Set esc_output to %f\n", ser_esc_output); + } + else if(command.equals("params")){ Serial.printf("Actual values: kp=%f ki=%f kd=%f \n", kp, ki, kd); }