Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   URGENT:Auto Problem trying to fix before tomorrow (http://www.chiefdelphi.com/forums/showthread.php?t=127331)

miw14 01-03-2014 06:59

Re: URGENT:Auto Problem trying to fix before tomorrow
 
Quote:

Originally Posted by pblankenbaker (Post 1351276)
Is it possible that your shooter takes more than 3.5 seconds to reach it's raised state? If it is mechanically OK to raise your shooter while you are driving you could start raising it at the start of auton at the same time as you start driving forward and let it run longer:

Code:

public void autonomous() {
    myDrive.setSafetyEnabled(false);

    // Start driving and lifting the launcher immediately
    myDrive.drive(-.5, 0.0);
    startRaisingLauncher();

    // Stop driving after 3.5 seconds
    Timer.delay(3.5);
    myDrive.stopMotor();

    // Stop raising launcher after 4.5 more seconds (8 seconds total
    // raising launcher)
    Timer.delay(4.5);
    stopMovingLauncher();

    stopAll();
}

You should be able to use your buttons in teleop mode to experiment with how long the total time should be in order to raise the shooter (don't assume the 8 seconds shown in the example above is the correct value).

Good Luck.

I bumped up the timer delay to 5 seconds and it did not seem to affect it at all. It should only take a second or two for it to fire.

mwtidd 01-03-2014 08:07

Re: URGENT:Auto Problem trying to fix before tomorrow
 
Quote:

Originally Posted by miw14 (Post 1351248)
Thank you! I am a little bit confused though. You said time is in miliseconds, but it seemed like the Timer.delay worked fine with seconds with the mydrive.

Another question about the code. For the time conditions in the else statements, are the last two statements supposed to be greater than signs instead of less than signs? *Nevermind, I believe I understand this now.

Lastly, what do you think was the problem with the original code?

Sorry I should clarify. My time was in mills, hence the System.currentTimeMills(). Delay is in seconds. So the delay is 100th of a second in my case where as the first segment is 3500 mills.

Yes, putting a greater than time would be redundant in this case. The second if (first else if) can only occur if its >= 3500 mills, as the first if reserves behavior from 0 to 3499 mills.

Sounds like you understood this, but I just wanted to make sure I conveyed it a little better.

pblankenbaker 01-03-2014 18:45

Re: URGENT:Auto Problem trying to fix before tomorrow
 
Can you add the following SmartDashboard outputs to observe the time the launcher should be raising and run your auton code in the pits with your robot up on blocks without loading a ball?


Code:

public void autonomous() {
    myDrive.setSafetyEnabled(false);

    // Start driving and lifting the launcher immediately
    myDrive.drive(-.5, 0.0);

    startRaisingLauncher();
    SmartDashboard.putBoolean("Raising Launcher", true);

    // Stop driving after 3.5 seconds
    Timer.delay(3.5);
    myDrive.stopMotor();

    // Stop raising launcher after 4.5 more seconds (8 seconds total
    // raising launcher)
    Timer.delay(4.5);
    stopMovingLauncher();
    SmartDashboard.putBoolean("Raising Launcher", false);

    stopAll();
}

If the delays are working properly and all of the code is being executed, you should observe a new value "Raising Launcher" appear on your smart dashboard and you should see it go true at the start of auton and then change to "false" roughly 8 seconds later. If you don't see it turn to "false" it indicates something has failed somewhere (you will probably have a stack trace in your console window on NetBeans).

Also, would it be possible for you to post your current code so we can see how your fire the ball in teleop? Maybe there is a step or procedure missing in auton.


All times are GMT -5. The time now is 13:03.

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