Thread: Autonomous Help
View Single Post
  #14   Spotlight this post!  
Unread 21-01-2015, 08:52
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,715
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Autonomous Help

Quote:
Originally Posted by curtis0gj View Post
This quote thing is driving me nuts, anyway this works right?
Code:
double angle = gyro1.getAngle();
    		double distance = encoder.getDistance();
    		
    		SmartDashboard.putNumber("Angle", angle);
    		SmartDashboard.putNumber("Distance", distance);
Also now that I have made my distance variable can I use it in my if statement like so, if(distance > 50) ?
Yes you can, but you are going to want to make sure that you put the distance variable in the second loop so it gets updated when you are driving.

Another thing I forgot to have you do is reset the encoder prior to the second loop. You can do this in the same place you reset the gyro.
Code:
encoder.reset();
Reply With Quote