×
INDI Library v1.8.6 Released (21 Aug 2020)

August 2020 release of INDI Library v1.8.6 introduces new drivers while providing fixes and improvements to existing devices and core framework.

Internal autoguide in EKOS makes thins worse

7 months 3 weeks ago 7 months 3 weeks ago by raul.
raul
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Internal autoguide in EKOS makes thins worse #50238

Bart wrote: Proportional, Integral and Derivative (PID) are the gain factors that are used in the commonly used PID control loop.
See:
en.m.wikipedia.org/wiki/PID_controller

Hmm. Very interesting ! Especially this one: :)
en.wikipedia.org/wiki/PID_controller#/me...nsation_Animated.gif
The following user(s) said Thank You Jeff Voight

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
knro
Administrator
Administrator
Posts: 8444
Karma: 51
Internal autoguide in EKOS makes thins worse #50239

Bart wrote: ...Which makes me think now:
Would it be interesting if there is a PID self-learning button? I wouldn't mind spending some time developing/ implementing a autotuning alghorithm if there is interest (Jasem?).


Hi Bart,

That would be totally *epic* if you can get this to automatically adjust itself somehow? Maybe some machine learning (hey, it's the hype these days!) or another general purpose method? Btw, for now, I don't think the integral gain has any effect, it's not used in the code itself. So the PID controls themselves need quite a bit of work. The proportional gain is there but IIRC, the integral or derivative gains are not used at all. Please let me know if you have any questions on this!

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
Bart
Senior Boarder
Senior Boarder
Posts: 52
More
Internal autoguide in EKOS makes thins worse #50243
No need for machine learning. PID loops are in existence for ages and so are tuning methods (for example the Ziegler and Nichols method). I found a few papers on more efficient auto-tuning algorithm that are interesting to try out. I'll PM later.

15 cm wavefront condensor | Earth rotation undo-er | Few photon discriminator plates | Photons to electrons transmogrifier | Stellarmate

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
wimvb
Expert Boarder
Expert Boarder
Posts: 133
More
Internal autoguide in EKOS makes thins worse #50310
PID control loops can start oscillating if the parameters aren't set properly. You wouldn't want that to happen to your mount. That's why derivative gain in lin_guider wasn't used. But if I remember correctly, integrating gain is used.

Wim

Opticron Oregon 15*70, Skywatcher 150PDS + ST80, AZ-EQ6 GT + EQ3-2 Goto, ZWO ASI174MM-Cool + Pentax K20D (retired) + ZWO ASI120MM, homemade ditherbox, PixInsight, Rock64 x 2 with INDI & PHD2, cloud cover

www.astrobin.com/users/wimvb/

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
raul
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Internal autoguide in EKOS makes thins worse #50349

wimvb wrote: PID control loops can start oscillating if the parameters aren't set properly. You wouldn't want that to happen to your mount. That's why derivative gain in lin_guider wasn't used. But if I remember correctly, integrating gain is used.

I'm a bit puzzled. As far as I can understand from the wikipedia page the integrative gain amplifies the oscillations and the derivative gain is the one that is smoothing the oscillations. Am I getting this wrong ?

Take a look at this: en.wikipedia.org/wiki/PID_controller#/me...nsation_Animated.gif

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
El Corazon
Platinum Boarder
Platinum Boarder
Posts: 952
Karma: 3
More
Internal autoguide in EKOS makes thins worse #50368

knro wrote:

Bart wrote: ...Which makes me think now:
Would it be interesting if there is a PID self-learning button? I wouldn't mind spending some time developing/ implementing a autotuning alghorithm if there is interest (Jasem?).


Hi Bart,

That would be totally *epic* if you can get this to automatically adjust itself somehow? Maybe some machine learning (hey, it's the hype these days!) or another general purpose method? Btw, for now, I don't think the integral gain has any effect, it's not used in the code itself. So the PID controls themselves need quite a bit of work. The proportional gain is there but IIRC, the integral or derivative gains are not used at all. Please let me know if you have any questions on this!


"The proportional gain is there but IIRC, the integral or derivative gains are not used at all."

That hurts!

After all the hours I have spent fine-tuning integral and derivative gain and convincing myself on how important they are...

Crushed!!!

:-(((

Atlas Pro AZ-EQ, ASI1600MM-Pro, ASI120MM-S, ES102ED, WO-Z61, Nikon D3300, ASI-EFW, ZWO LRGB,Ha,O3,S2 filter set

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
hy
Gold Boarder
Gold Boarder
Posts: 333
Karma: 4
More
Internal autoguide in EKOS makes thins worse #50369
Jo,

Don't dispair, there's hope! Though I have no clue as to how the internal guider works, your comment at least got me to search the source.
If you look at kstars/ekos/guide/internalguide/gmath.cpp at the method process_axes(), you can find the following lines:

// process axes...
for (int k = GUIDE_RA; k <= GUIDE_DEC; k++)
{
...
qCDebug(KSTARS_EKOS_GUIDE) << "delta [" << k << "]= " << out_params.delta[k];
qCDebug(KSTARS_EKOS_GUIDE) << "drift_integral[" << k << "]= " << drift_integral[k];

out_params.pulse_length[k] =
fabs(out_params.delta[k] * in_params.proportional_gain[k] + drift_integral[k] * in_params.integral_gain[k]);
out_params.pulse_length[k] = out_params.pulse_length[k] <= in_params.max_pulse_length[k] ?
out_params.pulse_length[k] :
in_params.max_pulse_length[k];

qCDebug(KSTARS_EKOS_GUIDE) << "pulse_length [" << k << "]= " << out_params.pulse_length[k];

and process_axes() seems to be called by perform_processing()

So, I can't be sure, but it seems to me that at least the proportional and integral gains are both used to compute the pulse length in the internal guider (no so much the derivative gain).
Turn out debug logging for the internal guider and look in your log for that "delta", "drift_integral" and "pulse_length" log line, and if you find them, this is probably the case.

Hy
The following user(s) said Thank You El Corazon

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
Herrhausen
Platinum Boarder
Platinum Boarder
Posts: 664
Karma: 3
More
Internal autoguide in EKOS makes thins worse #50372

hy wrote: So, I can't be sure, but it seems to me that at least the proportional and integral gains are both used to compute the pulse length in the internal guider (no so much the derivative gain).
Turn out debug logging for the internal guider and look in your log for that "delta", "drift_integral" and "pulse_length" log line, and if you find them, this is probably the case.


Thanks, Hy! Like Jo, I use to tune both parameters and in my experience they clearly both have an effect.

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
El Corazon
Platinum Boarder
Platinum Boarder
Posts: 952
Karma: 3
More
Internal autoguide in EKOS makes thins worse #50384

hy wrote: Jo,

Don't dispair, there's hope! Though I have no clue as to how the internal guider works, your comment at least got me to search the source.
If you look at kstars/ekos/guide/internalguide/gmath.cpp at the method process_axes(), you can find the following lines:

// process axes...
for (int k = GUIDE_RA; k <= GUIDE_DEC; k++)
{
...
qCDebug(KSTARS_EKOS_GUIDE) << "delta [" << k << "]= " << out_params.delta[k];
qCDebug(KSTARS_EKOS_GUIDE) << "drift_integral[" << k << "]= " << drift_integral[k];

out_params.pulse_length[k] =
fabs(out_params.delta[k] * in_params.proportional_gain[k] + drift_integral[k] * in_params.integral_gain[k]);
out_params.pulse_length[k] = out_params.pulse_length[k] <= in_params.max_pulse_length[k] ?
out_params.pulse_length[k] :
in_params.max_pulse_length[k];

qCDebug(KSTARS_EKOS_GUIDE) << "pulse_length [" << k << "]= " << out_params.pulse_length[k];

and process_axes() seems to be called by perform_processing()

So, I can't be sure, but it seems to me that at least the proportional and integral gains are both used to compute the pulse length in the internal guider (no so much the derivative gain).
Turn out debug logging for the internal guider and look in your log for that "delta", "drift_integral" and "pulse_length" log line, and if you find them, this is probably the case.

Hy



Thanks Hy!

Will do next time I have a chance, cloudy here again and I will be out of town for a few days.

Is there another section in the code where the drift integral is calculated? If that is not calculated and is always set to a default value of 0, then any setting of the integral gain would also == 0 according to how I understand that section of the code you posted here.

But the debug logs should show that, so will turn those on and report back once I have more data.

Jo

Atlas Pro AZ-EQ, ASI1600MM-Pro, ASI120MM-S, ES102ED, WO-Z61, Nikon D3300, ASI-EFW, ZWO LRGB,Ha,O3,S2 filter set

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago 7 months 2 weeks ago by wimvb.
wimvb
Expert Boarder
Expert Boarder
Posts: 133
More
Internal autoguide in EKOS makes thins worse #50392
"I'm a bit puzzled. As far as I can understand from the wikipedia page the integrative gain amplifies the oscillations and the derivative gain is the one that is smoothing the oscillations. Am I getting this wrong ?

Take a look at this: en.wikipedia.org/wiki/PID_controller#/me...nsation_Animated.gif"

Absolutely correct of course. In PID controllers, the response is determined by the effect of all three parameters together. It is a lot more difficult to get stable operation if you have more parameters to dial in. The differential part of the controller is sensitive to noise, and could create erratic operation. The integral part averages noise. It will also bring the error in the control system to 0, something which a P controller can't.

Wim

Opticron Oregon 15*70, Skywatcher 150PDS + ST80, AZ-EQ6 GT + EQ3-2 Goto, ZWO ASI174MM-Cool + Pentax K20D (retired) + ZWO ASI120MM, homemade ditherbox, PixInsight, Rock64 x 2 with INDI & PHD2, cloud cover

www.astrobin.com/users/wimvb/
The following user(s) said Thank You raul

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
Bart
Senior Boarder
Senior Boarder
Posts: 52
More
Internal autoguide in EKOS makes thins worse #50395
Absolutely agree with you Wim. The integral term is essential to arrive at an error of zero. Although even if there exists an error, it is static (i.e., the guide star is shifted from the 'set' position). This therefore should in principle not influence the guiding, since, once the system is settled, it is constant.
I've started to take a look at the source as well and found the same as HY. Only the P and I terms are incorporated. Does anyone here know what is the reasoning behind this?
Indeed the D term is sensitive to the slope (dT/dx) of the measured value (where x is the position in the respective control direction). I wonder if sensitivity to noise would be the reason for this.

By the way, here is a really nice explanation of a PID loop (on a microcontroller), and how to add several nifty things to make it respond better: brettbeauregard.com/blog/2011/04/improvi...rs-pid-introduction/

15 cm wavefront condensor | Earth rotation undo-er | Few photon discriminator plates | Photons to electrons transmogrifier | Stellarmate

Please Log in or Create an account to join the conversation.

7 months 2 weeks ago
wimvb
Expert Boarder
Expert Boarder
Posts: 133
More
Internal autoguide in EKOS makes thins worse #50400

Bart wrote: Absolutely agree with you Wim. The integral term is essential to arrive at an error of zero. Although even if there exists an error, it is static (i.e., the guide star is shifted from the 'set' position). This therefore should in principle not influence the guiding, since, once the system is settled, it is constant.
I've started to take a look at the source as well and found the same as HY. Only the P and I terms are incorporated. Does anyone here know what is the reasoning behind this?
Indeed the D term is sensitive to the slope (dT/dx) of the measured value (where x is the position in the respective control direction). I wonder if sensitivity to noise would be the reason for this.

By the way, here is a really nice explanation of a PID loop (on a microcontroller), and how to add several nifty things to make it respond better: brettbeauregard.com/blog/2011/04/improvi...rs-pid-introduction/


The internal guider is derived from lin-guider, so best try to ask the developer. My guess is, that the D term is sensitive to noise and doesn't add enough to the solution. As I mentioned before, you'd want to make sure that any combination of the PID parameters that are allowed, can't cause catastrophic behaviour of the mount. Oscillations may be cool in math, but I wouldn't like to see my mount swing. Also remember that any practical solution has to work for all possible mount and load combinations. And rather than make the D term less sensitive to noise, there are better solutions, such as the minmo parameter in phd.

Wim

Opticron Oregon 15*70, Skywatcher 150PDS + ST80, AZ-EQ6 GT + EQ3-2 Goto, ZWO ASI174MM-Cool + Pentax K20D (retired) + ZWO ASI120MM, homemade ditherbox, PixInsight, Rock64 x 2 with INDI & PHD2, cloud cover

www.astrobin.com/users/wimvb/

Please Log in or Create an account to join the conversation.

Time to create page: 0.449 seconds