Several programming and electrical questions

Hey guys,

My team, 4058, finished a few weeks ago, so I figured I should start learning some more in depth programming and electrical techniques (yes, I do both, on a small team) so that I can pass on knowledge to the younger members of the team

To start, I read a lot of teams were using PIDs on their shooters, and I am not sure what they are or what they do, so if someone could enlighten me it would be greatly appreciated.

Another thing I would like to learn is how to use vision tracking. At boilermaker regional, we were relegated to putting a piece of tape in the center of the camera image to aim (crudely), and I figured using vision tracking could make scoring exponentially easier in all games, not just rebound rumble.

The last thing I would like to know would be how encoders are used, how they are hooked up, and how they are programmed.

I apologize if some of the things I said make no sense. If they do, let me know and I will try to reword the question.

Thanks in advance for the help.

Here are a couple of links from FIRSTWiki:

There are also some technical discussions in other threads on CD.

If you are still wondering after the competition season (our regional is week 6 and my programmers are still busy) send me a message and I will have one of them get back to you.

What programming language are you using? If you are doing labview there are a whole bunch of examples and tutorials to show many of these situations.

FIRST Community on

I’m by no means an expert on any of the topics, but will give you a very high level understanding of each.

Encoders: These are devices that you mount onto a spinning shaft (i.e. shooter wheel shaft, or drive train shaft.) They are connected to motor controllers (i.e. jaguar) and tell the controller and/or cRIO how fast the shaft is turning, and in which direction it is turning.

PID: This is a very commonly used method to get some system measurement (usually RPM) to a desired value quickly and efficiently. Think about accellerating from a red traffic light just turned green, where you want to get to 60mph as quickly as possible. Initially, you will floor it, but if you were to leave the gas pedal there, you’d eventually be going much faster than 60. You don’t wan to leave it there until you get to 60, and then suddenly back off. Instead, as you approach 60MPH, you back off so that you smoothly get to 60. Similarly when braking. To stop when you see a yellow light, you first press on the brake pretty hard, but if you left your foot there, you would get quite a jolt at the end of the stop, so you back off on the brake as your speed slows. PID does the same thing, using a mathemetical model. It requires an encoder (or other feedback mechansm) to tell the model how far you are from your goal, how quickly you are approaching it and so forth.

Vision: One quick improvement to ‘tape’ on the image is that you can program your driver station to draw a cross-hair (or in the case of this year’s game a vertical line may be sufficient). One of the things we decided (sort of) this year is doing vision processing on the cRIO was over taxing of it-- so we send the image to the driver station. Once it is there, the best/fastest image processor we have is the human brain standing next to it. We have some ‘sweet spot’ shooting locations (key, midcourt, etc.) where we know the shooter speed needed (we have an encoder which tells us RPM). So we ended up not using any software for vision processing.

I use labview, I will look at some of those tutorials next opportunity I get.

Thanks for all the feedback, guys, really appreciate it.

Encoders can also be used to determine the position of a robot element, like the angle of an arm.