View Single Post
  #4   Spotlight this post!  
Unread 21-03-2015, 00:28
mshafer1 mshafer1 is offline
Programming Mentor
AKA: Matthew Shafer
FRC #3937 (Breakaway)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2008
Location: Arkansas
Posts: 53
mshafer1 is an unknown quantity at this point
Re: Controlling Motors in Auto

Quote:
Originally Posted by stopyourself View Post
As another rookie programmer, I can't explain the details to you very well but might be able to help you past some rookie mistakes. This picture would be moving the robot during auto using a flat sequence structure.
....
You can either use a flat sequence structure or while loops to do autonomous. Make sure you call the motor every 50ms or so -- if you tell it to do something once every 3 seconds or so, it will shut off after 0.5 seconds. Also, I've heard excessive while loops (bad stop conditions?) will bog up the processors and make it run slower. If you encounter this, fix that.
Stopyourself has made some good points.

Most important thing I can tell you is comment like crazy - you won't remember which frame is doing what once you get past about frame four.

Also, if at all possible, do not use time for the delay. There are some cases where there is no alternative (drive, unless you put encoders on for some reason), but the output will vary greatly with battery voltage, and even if it holds through qualifier matches, the quick turn around of eliminations will sink the battery, making the robot take longer to move the same distance.

I have tried to show some different simple things that can be used, a flat sequence, a time delay (some times its the only option ), and a limit switch, also some of the different places you can put comments.

Feel free to email me for help (click on my username and select send an email)
Attached Thumbnails
Click image for larger version

Name:	auto.png
Views:	49
Size:	66.1 KB
ID:	18695  

Last edited by mshafer1 : 21-03-2015 at 00:34. Reason: attaching image
Reply With Quote