Hello everyone,
I have a question, namely I am trying to set up a PID loop on imaginary data. That is, I have a difference in the direction between what is and should be, let's say 59.5 degrees, which will be my input_heading.
I define myself a PID loop and set the setPoint value to 0.
And I want to see the output value which is output_heading.
but no matter what i change i.e. Kp, Ki, Kd or input_heading i have 0 value at the output all the time. Can anyone help me what am I doing wrong??
The reasoning behind this is that if I give Kp=2 the remainder Kii Kd to 0, I should get 59.5x2 at the output on the first loop. Am I wrong?
Wokwi:
And code:
#include <PID_v1.h>
double setPoint_heading = 0;
double input_heading = 59.5;
double output_heading;
PID pid_heading(&input_heading, &output_heading, &setPoint_heading, 2, 1, 1, DIRECT);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
input_heading = input_heading+1;
output_heading = pid_heading.Compute();
Serial.println(output_heading,8);
// put your main code here, to run repeatedly:
delay(1000); // this speeds up the simulation
}