Controlling PID Gains from the Dashboard

Hi Chief Delphi

This year was the first time I did any major programming on our robot. To achieve shooter consistency I programmed “bang bang” control. Although it worked the way I wanted it to, I have been exploring the idea of PID. I would like to get some practice programming PID so that I can be better prepared to use it next year. I had no problems finding out how to program the loop, but from what I have heard, tuning the PID Gains can be time consuming. To make tuning the PID much quicker, I want to make an area on the dashboard where I can set each gain to find the values that work for our robot. I have used to smart dashboard tools before to create other indicators but I am having trouble with this one. Attached is an image of what I have so far. As you can see on the bottom, I made a control for the PID Gains from the PID vi and unbundled them to get each gain. If what I want to achieve is possible, what are the next steps I have to take. I tried hooking up the SD Read Number to it, but it resulted in a broken wire.

http://postimg.org/image/fof7m4xnn/

For those of you who cannot see the image it can be seen at the following URL:

http://postimg.org/image/fof7m4xnn/

Any help is greatly appreciated.

I believe your next step is to drop the SD Read Number and wire the numbers to the output of the case. Be sure to initialize the SD number elsewhere in the robot program to reasonable default values as you would have in your constants.

I can’t say for sure why the wires were broken, but the broken arrow can. Click on it and I suspect it will say that your wire has multiple sources. It may be because you didn’t delete the constant when you wired up the variable value.

If that isn’t why it was broken and you can’t resolve it using the broken arrow, please post the picture of the broken diagram or the text from the error so that I can be more helpful.

Greg McKaskle

The reason that wiring up the unbundle by name and the SD Read Number results in a broken wire is that they are both outputs. Is there any way to change the SD Read Number to an input?

http://postimg.org/image/b7sx41ys5/

http://postimg.org/image/qugoymyb9/

The problem is indeed that you have two outputs wired together. Rather than try to turn the SD Read into an input, it seems like you probably are looking to have a local/global switch.

If that is the case, the key is to place a case structure on the diagram, put the cluster terminal in the local frame, and place the SD Reads and bundle in the global frame. The attached image shows both the True and False frames one above the other.

Is that more what you were looking for?

Greg McKaskle





Thanks for the help, that seems to work code wise. I’ll test it out on the robot when I get access to it later next week.

If you have never tuned a PID loop before, there are many posts that give advice and some links to various approaches. It doesn’t have to be hard, but it is easy to get lost in the numbers and lose your way.

Take good notes of what values you tried and the results, and if possible, let a mentor, teacher, or someone else who has tuned help out.

Greg McKaskle

What kind of sensor are you using that is giving you 2 pulses per rev ?

*

2 ppr.png


2 ppr.png

Where do i find the vi that the arrow is pointing to on my attached picture, the one that connects to the last division sign and gos in to the pid loop vi?

Edit: Nevermind found it





For those wondering at home, that’s Number to Fractional String, found in the String/Number Conversion [i]Palette

*Palate?

What are the green and brown rectangles, and where do i find them?

Clipboard 1.png


Clipboard 1.png

Good question. One of the first things I generally do in a programming system or environment is learn about the help systems. Once I know that, it is easier to find answers to a whole range of questions.

If you are having trouble identifying what something is in LabVIEW, the first step is to open the Context Help window. It is under the Help menu and has Ctl-H as its shortcut. If the context help window is open, you can hover over the unknown item and the window will give you a summary of what the object is and what it does. This is especially true of the string and math icons in LabVIEW and of subVIs that other people have written.

In this case, it will tell you the data type and name of the item. It will contain a detailed help link in the window. If you follow that, it will explain that those are Front Panel Terminals and that they represent a Boolean and a Cluster of numbers on the Front panel. In this case, they represent the point in the diagram when it will read the button and cluster and use the values on the diagram. If you need to go deeper, it will often link to an example or related topics.

Hope that helps. Please ask if you have other questions.
Greg McKaskle