Go to Post Dee and I pooling our brain cells almost make a full deck... - RoboMom [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
  #1   Spotlight this post!  
Unread 03-28-2016, 09:48 PM
MRT45's Avatar
MRT45 MRT45 is offline
Registered User
FRC #0253 (Mills Robotics Team)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: CA
Posts: 14
MRT45 is an unknown quantity at this point
Autonomous not stopping. Constantly running... during enabling

Hey Guys,
I decided to get autonomous to work this year and ran into the problem of an unlimited run time despite a set stopping point.

Can someone check this out and find the problem? I honestly don't know what the problem is.

I may be overlooking something simple, but I am clearly not seeing it.
Code:
 
    public void autonomousInit() {
        // schedule the autonomous command (example)
       // if (autonomousCommand != null) autonomousCommand.start();
    	//autonomousCommand.start();
    	  // Reset timer to 0sec
    	edu.wpi.first.wpilibj.Timer myTimer = new edu.wpi.first.wpilibj.Timer();
        myTimer.reset();

        // Start timer
        myTimer.start();
    	
       // move(-0.5,3.0);

    }

    /**
     * This function is called periodically during autonomous
     */



 public void autonomousPeriodic() {
// link  -https://www.reddit.com/r/FRC/comments/3zcc2d/timer_not_working/
        // If is has been less than 2 seconds since autonomous started, drive forwards
    	
    	edu.wpi.first.wpilibj.Timer myTimer = new edu.wpi.first.wpilibj.Timer();
        if(myTimer.get() < 2.0){
        	Robot.drivetraintank.setLeft_Back(0.5);
        	Robot.drivetraintank.setLeft(0.5);
        	Robot.drivetraintank.setRight(0.5);
        	Robot.drivetraintank.setRight_Back(0.5);
        }

        // If more than 2 seconds have elapsed, stop driving and turn off the timer
        else {
        	Robot.drivetraintank.setLeft_Back(0.5);
        	Robot.drivetraintank.setLeft(0.5);
        	Robot.drivetraintank.setRight(0.5);
        	Robot.drivetraintank.setRight_Back(0.5);
            myTimer.stop();
        }

    }
    	
    	
       // Scheduler.getInstance().run();
__________________
Member of the MILLS ROBOTICS TEAM - 253

"Everyone and everything is like a formula. You may seem small, but God has spent a long time making you right." - Wayne Phillips
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 07:28 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