View Single Post
  #8   Spotlight this post!  
Unread 02-20-2015, 07:55 PM
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: functions for auto

Quote:
Originally Posted by Arhowk View Post
Preferably it would be the last line (with it at the first, theres a 20ms delay before any actions are performed)

Your indenting for everything after "wait" is now wrong

AUTOS should not be capitalized (and should be descriptive: "AutonMode", "SelectedAutonMode", "AutonEnum", etc)

turn and turn2 still need to be turned into feedback loops but for now rename them to turnLeft and turnRight and make one function- turn- that if gyro < desired than turnLeft(angle) else turnRight(angle)

capitalization schemes are wrong in Robot.java (http://java.about.com/od/javasyntax/...onventions.htm)

Code:
		if (autoMethod == Defines.AUTOS.AUTO_ONE) {
			return;
		} else if (autoMethod == Defines.AUTOS.AUTO_MOVE) {
			return;
		} else if (autoMethod == Defines.AUTOS.AUTO_TWORED) {
			return;
		} else if (autoMethod == Defines.AUTOS.AUTO_TWOBLUE) {
			return;
		}
this block of code is rather... erm...

Why is your wait function inside of a while(true) loop?
lol I did a very lousy job of naming things, sorry for that and I will change the names to be more descriptive and properly cased. Anyway how can I get the waits to work again? This is the function,

Code:
	public static void turn(Robot r, double deg) {
		while (true) {
			double angle = r.gyro.getAngle();
			if (!r.isAutonomous() || !r.isEnabled()) return;
			if(angle < 70) {
				turnRight(r, 70);
			} else {
				turnLeft(r, -70);
				reset(r);
				break;
			}
	}
I'm not sure how to program it, sorry I'm still fairly new to programming.
Reply With Quote