Thread: Autonomous Help
View Single Post
  #1   Spotlight this post!  
Unread 01-19-2015, 06:12 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
Unhappy Autonomous Help

Hey all, newbie programmer here looking for some help with my autonomous code. At the moment I need to be able to turn 90 on the spot using a gyro stop and drive straight also using a gyro and encoder for distance.

Code:
public void autonomous() {
    	
    	while(isAutonomous() && isEnabled())  {
    		
    		SmartDashboard.putNumber("angle", gyro1.getAngle());
    		
    		double angle = gyro1.getAngle();
    		
    		robot.drive(-0.20, 1);
    		
    		if(angle > 83) {
    			
    			robot.drive(0,0);
    			
    			break;
The issue I have is the robot won't stop turning . I need a basic tutorial on setting up an encoder for distance. Also if anyone could show me how I could start driving straight after this turn, Thanks for the help.
Reply With Quote