I am a rookie programmer (The only one actually) and I am wondering if anyone could give me a bit of help in getting an autonomous program working. First you should know a bit about our robot:
We are using a tank drive with the standard wheels given in the KOP
We have 4 wheels powered by 2 motors, so 1 motor controls both wheels on each side.
We are using the standard frame given in the KOP
On the back of our robot is an ‘arm’. It is used to lower the bridge.
So, I had a bit of fun playing with autonomous mode the other day, I got the robot to spin a bit. The problem is, I have absolutely NO idea how to specify speeds or how to activate a piston in autonomous. I have 2 days so I REALLY do not want to play with it much, I just want a bit of help getting it done. Could someone give me an example on how to get the robot to move straight for X amount of time/distance and then after that is complete activate a piston?
Thank you very much.
EDIT: I got the robot to move forward, I still cannot get the piston to fire at the correct time.
The template code autonomous function had some for loops and robot drive functions disabled. You can right click on them and enable or remove the disable structure.
To time how long it has been since autonomous started, take the time at the beginning, take the time after some other operation and subtract and compare to your trigger point.
I’m pretty sure I just do not know how to activate the solenoid in autonomous. I have been using ‘WPI_SolenoidSet.vi’ inside a while loop…I want it to activate and stay activated until the end of autonomous…how is that possible?
As long as the Safety mechanism hasn’t been turned on, the solenoid will stay on set until you turn it off. When the robot is disabled, the solenoids will also be disabled, but will return when enabled.
So before I was using a while loop but now decided to switch it up to make it easier…now all our robot does is have the wheels move for a split second and then it shoots the piston. What am I doing wrong?
You don’t explain what the robot does or doesn’t do. I’ll transcribe what I’d expect that to do.
It sets the RobotDrive to 0.5, which is normally backwards pretty fast. It leaves it set that way for ten seconds. Then it kills power to the RobotDrive and lets it coast/brake for four seconds. Then it sets the relay to forward.
Issues/Questions:
Unless your normal teleop negates the joystick values that it sends to the RobotDrive, this looks like it will drive backwards.
Unless your turn off the Safety Mechanism for RobotDrive, after 100ms, the motors will be disabled. If you develop carefully and want to disable it, you can do so from the Advanced palette of RobotDrive.
Driving backwards is the goal for how the robot drive is currently set up. I entered random numbers for the time each task is done just to make sure it follows it, I know that I have the values up VERY high currently.
Thanks for the info on why it is stopping though! I am not with the robot right now so I cannot experiment for myself so I am wondering: What .vi do I place instead of the current drive vi? I am confused as to what I am exactly doing for it to not shut off in 100ms. Another issue: It does not usually wait 4 seconds like I have it set to before the piston is fired, do I have to do something there or was the immediate stopping of the motors causing it to speed up or something?
you don’t need to replace it, but you need to disable the safety threads on those motors. To do that, go to robot drive and then hit the advanced functions button, there you will find the safety config VI.
You just need to connect it in front of the actual drive VI that sets the output. Make sure you have the robot on blocks until you know EXACTLY what you are doing with the autonomous. Once you disable the safety, the robot will move until you tell it to stop.
Please do start with it on blocks, but to be clear, eStop still works and cannot be disabled. Safety Config disabling is specific to the update heartbeat.