Go to Post Wow... no duct tape? - Stormnnormn [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 01-19-2015, 07:31 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: Autonomous Help

Quote:
Originally Posted by curtis0gj View Post
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.
I think I have solved this but I don't have a way of testing it until tomorrow, I think the issue is the double angle = gyro1.getAngle(); is in the while loop so it's just getting the angle over and over... But I still need help with setting up an encoder if anyone could help that would be great!
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:08 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi