Go Down

Topic: PID adaptive cruise control (Read 3562 times) previous topic - next topic

jremington

#15
Oct 14, 2019, 04:31 pm Last Edit: Oct 14, 2019, 04:43 pm by jremington
Here is my suggestion again: read the "How to use this forum" post for hints on how to post.

But, if PID is programmed according to convention, these values should never be negative:
Code: [Select]

double kp = (0 - 8);
double ki = (0 - 1);
double kd = (0 - 0);

Have you considered using K values other than integers? What are the extra zeros doing?

Study this overview: https://en.wikipedia.org/wiki/PID_controller

sandert93

Thank you for the overview and the forum rules, i will carefully read them after work.

Here is my suggestion again: read the "How to use this forum" post for hints on how to post.

But, if PID is programmed according to convention, these values should never be negative:
Code: [Select]

double kp = (0 - 8);
double ki = (0 - 1);
double kd = (0 - 0);

Have you considered using K values other than integers? What are the extra zeros doing?

Study this overview: https://en.wikipedia.org/wiki/PID_controller
The reason why i made the K-terms negative is because i had to reverse the direction control. In my case the robot was speeding up when the measured distance became smaller. Somewhere in brett beauregard`s:" Improving the beginner`s PID tutorial" i saw this piece of code and gave it a try.
Here is the link: Improving the beginner's PID: Direction Control

i also tried other numbers than integers, these numbers are for testing purpose to see if the algorithm is working correct.

jremington

#17
Oct 14, 2019, 07:16 pm Last Edit: Oct 14, 2019, 07:21 pm by jremington
Quote
The reason why i made the K-terms negative is because i had to reverse the direction control
Reverse the output direction instead. This option is included in the library that you so desperately avoid.

sandert93

Reverse the output direction instead. This option is included in the library that you so desperately avoid.
Does changing the output direction not only change the direction of the wheels spinning?
The goal is to follow an object, so changing the output direction would move the robot away from the direction and increasing the error (because the wheels spin the other way) instead of keeping up at the object and decreasing.

Correct me if i`m wrong.

jremington

#19
Oct 14, 2019, 10:37 pm Last Edit: Oct 14, 2019, 10:37 pm by jremington
The PID algorithm does not specify which direction robot wheels should be spinning.

That is something you must do in your control program, using a motor controller. Speed and direction are separate inputs.

Go Up