Making PID values adjustable from within Ground Control

Two different issues that I fixed today had to do with adjusting the PID values for the controller.

These values adjust how the machine responds to a command to change position. If they are too small the machine won’t respond quickly, if they are too large the machine will oscillate and move jerkily.

Finding the ‘right’ values is as much an art as a science, and the values I have in place now are just my best somewhat informed guesses. I think it would benefit the community as a whole to make it possible to change the PID values from within Ground Control and try different options.

I have a couple concerns with doing this and want everyone’s feedback on how to do it right.

Here are some thoughts:

PID tuning is an advanced topic and most people will probably never want to mess with it so the settings should be hidden under ‘Advanced Settings’

There should be a “Restore PID Defaults” button to restore the default values if someone makes changes that don’t work well

Values stored in the settings file are tough to update from my side. With the values hard coded in the firmware it’s easy for me to make a change and push it out to everyone’s machines in the weekly firmware update. Values stored in the settings file aren’t overridden when Ground Control is updated (normally a great thing). This means that it will be tough to update the PID values with a weekly release. We could force those values to be overwritten by the weekly release, but then anyone who had chosen new values would loose them each week.

Does anyone have a good solution for that one?

2 Likes

How about a check box?

Use custom PID Values?

If checked then the settings for the PID values become editable and are used.

If unchecked, then ground control will send whatever the default ones are

4 Likes

I like that a lot!

How do you feel about the behavior being:

Settings are grayed out and can’t be changed by default

Checking the box to turn them on makes it so you can edit them

Unchecking the box makes them grey again and restores the defaults

That way if you are ever editing them and want to go back to the defaults just uncheck the box

Great suggestion!

3 Likes

Would we want the custom settings to be saved? I dunno maybe someone wants to go back and forth between the two when experimenting? I don’t think this is super critical, I suspect most people will never touch this.

3 Likes

I would like the custom settings to be saved - that would facilitate testing. A radio button to choose between the two sets, with the custom set editable, would be favorite.

3 Likes

Yeah, maybe I’m missing something, but wouldn’t the “reset default” button perform the “pull from @bar’s new values” if you have pushed a new update? If somebody is hard core enough to be messing with PID values, then they will be updating frequently from your pushes, and can reset to “your value” if desired.

Great suggestions everyone!

I will make it so that if the switch is on the custom values will be used, if the switch is off the default values will be used but the custom values will be saved.

Another advantage of this system is it makes side by side comparison to test new values simple :+1:

1 Like

Will we be able to save multiple values or just one custom set? That would allow for multiple sets to be tested as quickly as possible. Would also be great for using different bit sizes that require different sets to run optimally.

On that note would it be possible to have Ground Control automatically select sets based on your bit selection? I get that the majority of users will likely only use one bit, but some may want to use multiple bit sizes. Am I correct in assuming that the error corrections would need to change for different bit sizes?

There are now settings options to manually adjust the PID values in Ground Control.

If the switches are off, a set of default values are used. If they are turned on, the values shown in the settings are used. It is possible to switch between the two mid way through a cut, but keep in mind that the PID controllers “learn” so a truly fair comparison between two sets requires a power cycle by pulling out the USB cable. I

I haven’t had time to test these thoroughly, so use with some caution for now. I’ll give them a through inspection on Monday, but feel free to give them a go!

And most importantly if you find a set that you think works better than the defaults, share them and we’ll all benefit!

4 Likes

we do need different pid tuning values for the different motor types/loads, so
the Z axis and the other two motors will usually need different values.

1 Like