|
Re: New Programmer looking for some help!
Can't guarantee I've spotted everything, but here's a couple of my thoughts:
It looks like the robot will drive straight, not in a circle, because you have the Jaguars set to the same speed. Unless, of course you have one of the Jaguars wired "backwards" *.
Also, as it stands right now, the cRIO will speed through the For loop in a very small fraction of a second, so all you will see is your robot take off at high speed. Unless of course your program resets the motors after autonomous completes, in which case it will just sit there, because the autonomous will start and stop in that small amount of time. Instead, put a call to the Watchdog Delay and Feed VI in the loop, and tell it to wait ~10 ms each loop. This will make your robot accelerate to full speed in one second. You may want to put some delay after the loop as well to just give it some time to spin.
Not necessary, but just good coding practice would be to set both Jaguars to 0 speed after the autonomous finishes to make the autonomous code more independent from the other parts of your program.
You should probably be careful about opening motors in the autonomous routine, because if you're opening them in the teleop portion as well, you might get errors (haven't tested this to be sure). Try opening them once at the very beginning of your program, then passing around the device reference using a global variable.
If you do, in fact, want to open the motors in your autonomous, you should close them after the autonomous finishes.
Nothing wrong with it, but just note that +1.0 is maximum forward speed, so the last 400 iterations of your For loop won't have any visible effect.
That's all I see at the moment. Good luck!
--Ryan
* quotes because this would mean you actually have them wired the same. Since the motors are physically oriented opposite directions, you should have the motor leads connected to the Jaguar switched. Some people will argue that you can just open the Jaguars with one inverted, but I like to change it in wiring, because the Victors at least had an asymmetric deadzone. Not sure if the Jaguars continue this "feature."
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
|