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?
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.
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.
Tell your arms to close on the tote. Wait 1 second for the arms to respond
Tell your lifter to pick up the tote. Wait 1 second for the lifter to pick it up
Whatever commands you need to move the robot and tote to the Autozone.
Tell your lifter to lower the tote. Wait 1 second.
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.
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.)