but the motors still overshooting and partially jerking or strongly oscillating.
I know that there is a autotune lib, but my Arduino skills are too low and my English is too poor to understand how to use that, regrettably.
I don't know your particular PID implementation (does it have anti-jerk function, does it have gain-scheduling, do we really have a Kp-Ki-Kd-Implenetation or is it in real an Kp-Tn-Tv-implentation, what is controlled, position or speed, resp. do we already have an integrator as a apart of the process, etc.), but i'll try to give some hints:
Start with the conservative gains (ConsKx). In the first step set the differential part to zero and reduce the integrator gain (Ki) to the half. Does the overshoot decrease? if yes, proceed with halfing the gain till you are satisfied with the remaining overshoot.
Give me a feedback about this, then we will talk about further steps.
As I wrote, I already tried to tune it manually, but I failed: the values I reported above are the best I could achieve, but the motors still are overshooting and partially jerking or strongly oscillating (depending on load).
For the aggresive values I started from high values ( 10, 100,100) and decreased them,
for conservative values I started fron close to zero (0.1, 0.0, 0.0) and increased them.
Both have been matching closely to one another as you might observe.
Of course I could not try either thinkable combinaton at 0.01 steps each, but I tried some reasonable changings though.
I'm using the Lego Encoder motors and the PID controller of the PID_v1 lib.
Of course every motor and every encoder has to be tuned by either lib individually.
So my question was actually if anybody managed to tune the Lego encoder motor satisfactorily for the PID_v1 lib by appropriate Kp, Ki, Kd combinations without jerking, without oscillating and without overshooting!
I'm really curious if someone has managed that, if it wouldn't be possible then the PID_v1 lib is supposed to worky faulty, perhaps.
A set of PID control parameters is always optimised for a particular load so you need to apply the system load before you attempt tuning. Differential action is unlikely to be needed for simple motor control strategy as the response time of a motor to a change in load or set-point is usually very fast. Differential comes into its own in long time constant systems such as temperature control. If you are building a crane or a robotic arm, differential action will be of use to provide high rate corrective input until your load gets near set-point.
I'd suggest you remove all integral (and differential if being used) and increase gain (proportional) until you get oscillation starting, then reduce proportional until all oscillation stops. You should now find an error (offset) between desired set-point and actual position. Gradually increase integral action to eliminate this off-set. You may find oscillation starts again, if so gradually decrease proportional action.
First tune just P and D with I set to zero. Tune for maximum P that gives stable response
Then carefully experiment with I until you get fast enough convergence to the precise value
without oscillation (you increase D to combat oscillation if necessary). If there is random
fluctuations then that's the D term being too high.
As I wrote, I already tried to tune it manually, but I failed: the values I reported above are the best I could achieve, but the motors still are overshooting and partially jerking or strongly oscillating (depending on load).
...I want to have optimized PID parametrs which I can use out of the box
...by someone who already figured out the most optimized constants for "rotate to encoder target".
It should always be possible to prevent overshoot if you are manually tuning. If best means no overshoot then
you haven't achieved the best tuning yet. You have to trade speed for overshoot - small amounts of overshoot
enable faster response.
PID tuning has in part to be experimental, unless you have a very detailed and accurate model of the electrical
and mechanical aspects of the system. Note that tuning depends on the load and if the load varies you will
have to compromise somewhere or use something more sophisticated than a simple PID controller.
I actually didn't ask for additional tuning advices!
Which part didn't you understand?
As I wrote, I already tried to tune it manually, but I failed: the values I reported above are the best I could achieve, but the motors still are overshooting and partially jerking or strongly oscillating (depending on load).
...I want to have optimized PID parametrs which I can use out of the box
...by someone who already figured out the most optimized constants for "rotate to encoder target".
YOU do not seem to understand
You have been advised twice that tuning parameters depends on (mechanical) load so parameters simply cannot be used "out-of-the-box" without giving consideration to the application.
I have already tuned the Lego motors by a PID controller programmed by my own (targeting the Lego FW bytecode interpreter) and I know for sure that certain PID constants in a very small range fit to all common applications, e.g. a vehicle drive or a robot arm drive:
=>
But THIS is an example for the best I could ever achieve using the PID_v1 lib - don't know why, maybe the PID_v1 lib is faulty:
=>
(WTF! forum's editor does not load the images !! - see attachments!)
So I just need this set of constants for the PID_v1 lib
by someone who already figured out the most optimized constants for "rotate to encoder target".
...which I can use out of the box
That was what I asked for, no different kind of advices.
no one here in this forum who ownes Lego encoder motors and is experienced in tuning the PIDv1 library ?
(or maybe another PID for Arduino (Mega + Due) lib is working less faulty ?)
I know for sure that certain PID constants in a very small range fit to all common applications, e.g. a vehicle drive or a robot arm drive:
There are a great many people who would be interested in those PID constants. You say you are aware of those PID constants. Please provide them. A mathematical proof is also needed.
just look at the first image I uploaded, they have been displayed for the Lego bytecode PID regulator which I once have developed by my own.
My PID values are for vehicle drives and robot arms (medium to high torque).
As the PID values are for another code and another fw they cannot be taken for PID_v1.
The best values for PID_v1 which I could achieve so far have also been reported, but they are still working far too bad.
Topic is that I need values which already have been optimized for the Lego motors and PID_v1, nothing else.
Topic is that I need values which already have been optimized for the Lego motors and PID_v1, nothing else.
PID control is about the SYSTEM. The complete and entire system. A system which you have not yet described. Which means the only advice anyone can possibly give you is general tuning advice. If you want better answer provide more details.
There is no such thing as "magic PID parameters" that allow you to ignore the load. There is no such thing as "magic PID parameters" that allow you to ignore the attributes of the motor. There is no such thing as "magic PID parameters" that allow you to ignore any part of the system.
Your stated goal is impossible to achieve. It is mathematically impossible. It is provably impossible.
From your brief description you are trying to build an adaptive controller. But that is a guess. I suggest, instead of obsessing about PID, you describe the GOAL instead of the method.