Programming Pneumatics in Autonomous

Ok, so I have everything programmed for teleop, but I am lost with autonomous. Everyone is saying it’s the same thing as teleop, but I don’t understand what that’s supposed to mean. Can someone walk me through this or show me an example of controlling pneumatics during autonomous?

Also, we have a motor being used for the arm, so can someone show me how to program that to go forward and backward during autonomous?

Thanks! :smiley:

What language are you using?

It really is no different than teleop.

Instead of waiting for a user input, such as a button press, you wait for a different trigger, such as encoder ticks/time.

The actual code to deploy the pnuematics is the EXACT same. Just place the line of code you use in teleop in your auto method, at the appropriate time.

I’m using LabVIEW.

Alright, so I think I’ve kind of got the idea of it. I can open the solenoid, but I don’t know how to set it up afterward. What I’m really trying to figure out is how to tell the solenoid to open/close. If I use time, how do I tell it when to open, close, and how long to open it for? How do I tell it to open and close if I’m trying to do it after moving? Do I just string the two together?

Sorry if these questions seem silly, this is my first year programming and we have no alumn/mentors to help out.

Set a timer, and use some variables.

You use the variables to keep track of where you are/what you want to do.

In autonomousinit (or something like that), you get your parameter for what you are going to do (which autonomous program steps to run), initialize your variables, initialize your pneumatics, etc. This is just like TeleopInit.

Then, like there is a call to Teleop, there is a call to Autonomous.

Inside Autonomous, you have a while loop. Let’s say you want to pick up the tote and move to the Auto Zone.

  1. Tell your arms to close on the tote. Wait 1 second for the arms to respond
  2. Tell your lifter to pick up the tote. Wait 1 second for the lifter to pick it up
  3. Whatever commands you need to move the robot and tote to the Autozone.
  4. Tell your lifter to lower the tote. Wait 1 second.
  5. Tell your arms to open up and release the tote.

The Patriots are using LabVIEW.

You will probably have the easiest time using what’s called a Flat Sequence structure. It’s like a filmstrip. Inside each frame you can set something to happen, and you can put a Wait function in the frame to determine how long until the next frame can start.

You control the solenoid exactly as you would in Teleop, using a Solenoid Set function. But instead of choosing which direction to control it based on a Joystick or gamepad button, you use a constant.

If you don’t know how to control solenoids in Teleop, Team 358’s examples might be useful. Look at the Single Solenoid Example and the Double Solenoid Example immediately following it.

I would use a case structure inside a wild loop with shift registers. This is the easiest method for me and the kids I teach it to.

Thank you all so much! I’m currently in the process of creating the code since it took me a day to put together what everything means and understand all the information. (Everything clicked once I realized what a while loop was.) :slight_smile:

We use C++ is there any Example