View Single Post
  #13   Spotlight this post!  
Unread 28-02-2014, 23:50
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: URGENT:Auto Problem trying to fix before tomorrow

Quote:
Originally Posted by miw14 View Post
Hmm... I think I may have figured out the problem. Would I also need to have the setSafetyEnabled method with the shooter object and the driver object?
I feel like that is the problem. When I changed the timer delays between on shooter and off shooter, it had not effect. I wonder if the setSafetyEnabled method has anything to do with that.
Ideally you wouldn't disable the safety enable. Now, given that you're at comp, i'm not going to suggest enabling it at this point. However, we can rearrange your code to ensure that the drive is updated enough.

Time is in milliseconds. Unlike other programming platforms, the crio really does not like long delays. Thus it's better for you to manage time, and adjust your motor outputs based on time.

Code:
public void autonomous() { 
        myDrive.setSafetyEnabled(false); 
        
        long startTime = System.currentTimeMillis();
        
        while(isAutonomous() && isEnabled()){
            long timePassed = System.currentTimeMillis() - startTime;
            if(timePassed < 3500){
                myDrive.drive(-.5, 0.0);
            }else if (timePassed < 5000){
                myDrive.stopMotor();
            }else if (timePassed < 8500){
                startRaisingLauncher();
            }else{
                stopMovingLauncher();
                //stopAll();
            }
            Timer.delay(0.01); 
        }
        
        stopAll();
    }
__________________
"Never let your schooling interfere with your education" -Mark Twain
Reply With Quote