Programming Autonomous pneumatic kicker

We have finished making the main program for the robot but we do not know how to program the pneumatics for a kicker in autonomous.
I am a rookie programmer so pictures and a detailed explanation would be MUCCH appreciated.

Thank you so much~ (:


How are you kicking the ball?
How are you kicking the ball in telop mode?

Gives us some idea on how your robot is going to kick a ball and I am sure someone can tell you how to program that.

Just about every team has a different way to kick a ball.

We have two cylinders with two solenoids and three magnetic relays. Two of them go on the back cylinder and one on the front. When the back cylinder is cocked back with a button the front one with only one magnetic relay goes out. Than another button is pushed and the back cylinder with the two relays are shot out and the front one with the one relay pulls back releasing the kicker and it than kicks the ball. Sorry if this is a little confusing :confused:

you can look at the pictures for a better understandingg<333




Let me see if I understand
We need to break it down into each single step.

1 Somebody presses a BUTTON (???) On the joystick?
2 The BACK cylinder Extends to the cocked position?
3 Limit Switch detect BACK cylinder is cocked.
4 Causing the FRONT cylinder extend
5 Then somebody presses another button (???)
6 Both cylinders retract at the some time kicking the ball.

I assume this is how it is done in Teleop with the button pressing.
Do you have code that now works in Teleop mode using buttons and you need to replace the buttons pressing.

How will you detect that a ball is present and it is time to kick. (A timer? Distant traveled? A limit switch?)

I am not sure how you are using all the limit switches.

Anyway does the flow of the VI match what is actually going on in your code? (15.7 KB) (15.7 KB)

Is it possible to get your phone number to explain to you better how it works? If not well:
number 6 is wrong and there are only 2 solenoids
the one in the front retracts after the cylinder in the back comes back out

in teleop:

  1. Button #3 is pressed - back cylinder is cocked back and turns on relay 1
  2. After relay 1 shows that the back cylinder is cocked back, the front cylinder goes forward and grabs the kicker
  3. relay 3 on the front cylinder than shows that the kicker is ready to shoot
  4. Button #1 is pressed - back cylinder shoots out and turns on relay 2
  5. After relay 2 is on, front cylinder pulls back, releasing the kicker

(however we have not actually tested it but what we have on the computer, logically should work (we think)) ://

During teleop we are just going to guesstimate if the ball is in the right position and than kick

but in autonomous, we want to use a timer
and yeahh~

Can you post the part of your Teleop code that deals with items 1 to 5 above and I will look at it and advise from there.

To code your kicker you need to break down the steps even farther.

When you are ready to arm the kicker (the start of Autonomous mode or the end of your driving code)

  1. There is no Button #3 to press
  2. Solenoid #Back is set True (or False, I don’t know which)
  3. Back cylinder starts to move.
  4. Loop Reading DIO IN #1 (Relay 1) until it True (Back cylinder is cocked).
  5. Solenoid #Front is set True (or False, I don’t know which)
  6. Font cylinder starts to move.
  7. Loop Reading DIO IN #3 (relay 3) until it goes True (Front cylinder is extended)
    The kicker is armed and ready to kick

If the driving part is done (the robot is at a ball) AND the kicker is ready

THEN in place of pressing Button #1
8. Set Solenoid #Back to False. Back cylinder starts to move
9. Loop Reading DIO In #2 (relay 2) until it goes True
10. Set Solenoid #Front to False. Front cylinder starts to move back kicking the ball

Repeat for next ball

Her is the program that i made in the Tleop. for the kicker.

There are 3 limit switches Two are for the back cylinder that detects if the foot is cocked back and the last one is for the small cylinder that tell us if it has retract to let the foot out.

Kicker2.bmp (60.1 KB)

Kicker2.bmp (60.1 KB)

Here is a suggestion.
We built our kicker control as a single State Machine. It runs as an independent Vi. It only needs one external signal to cause it to fire the kicker. That signal comes from a joystick trigger in Tele or from the Autonomous code during Auton.
The State Machine takes care of reading all sensors and recycles the kicker automatically and gets it ready to re-fire in 2.5 seconds.

Can you explain me more about what you said about a single state machine i dont understand

or if you have any more advise i would apresiated.

thank you

Let’s start with what a State Machine is. It is a series of steps, or states, that a machine or software runs through to perform a task.

Let’s use the kicker as an example.

State 1: Precharge Kicker
State 2: Wait for “Fire” signal. Release kicker.
State 3: Wait .5 sec. for kick to complete.
State 4: Retract kicking mechanism.
State 5: Wait for retraction to complete.
State 6: Latch mechanism. Return to state 1.

The best advice I can give at this point is to visit

It will teach you all you need to know to start building state machines.
(This is not a paid advertisement for

I’m attaching an example vi. You will also need to create the DevRefNum’s in the

Kicker State (17.5 KB)

Kicker State (17.5 KB)

I am trying to make a very similar state machine kicker myself.

My problem is this: Say you tell your program to “wait” in a particular state for two seconds while a piston extends… I would expect the rest of your program to “freeze” for two seconds while that state machine code waits to execute. We want to be able to continue driving around and entering comands while our ball kicker state machine does its thing.

The key is to have the vi run parallel to all other process. This way the other process, ie, do not have to wait for the kicker to cycle. We did this by placing the kicker state mchine in the (See the attached picture) It requires no input from any other processes to complete, therefore it runs immediately. It also doesn’t output any information that other vis need.

I tried you example, changed everything around and put it in the main vi, but it did not function properly and i could not drive my motors in teleop. I’m trying to make so that when a button a latch is released by a piston retracting to fire a kicker from the default, then two pistons extend to reach the kicker and the latch piston extends to grab the kicker. Then the two pistons retract to rearm the device and the cycle repeats. I tried to implement that to your example but with no luck and also while running I could not drive the motors on the robot. Thanks for any help.

The “wait” in a state machine is NOT code that causes the processor to loop there until a desired amount of time has passed. Rather, it is code that tests whether the desired amount of time has passed, and if not, allows execution to continue. On the next iteration, it tests again. It keeps testing every new iteration until the desired time has elapsed, at which point it performs some action and changes state so it is no longer waiting.

You can put such a state machine in teleop along with other state machines and they will all peacefully coexist - i.e. they will all appear to execute “simultaneously”, since none of them contain any code that “freezes” the processor waiting for time to elapse.


You can of course do what you want with your code, but the framework gave you places to put code so that you wouldn’t need to modify Robot Main.

Any code that you put into TeleOp or the Robot Main loop needs to finish within 20ms or it will start to affect the joystick code handling. This can be done provided you write the code to retain when something started and do time comparisons to determine when to move to the next kicker stage, note that time, etc.


You can write the code with delays, but put that code into a parallel loop such as Periodic. Then in teleOp, you read the joystick and other stuff and if the conditions are right, you trigger a kick by setting a global. In periodic, you poll the global and start the sequence. At the end of the sequence, you clear the global.

Greg McKaskle