Go to Post I think we can all remember, no matter our age, that we are always responsible for our own actions and reactions. - JaneYoung [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

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 01-03-2014, 06:59
miw14 miw14 is offline
Registered User
FRC #4840
 
Join Date: Feb 2014
Location: Michigan
Posts: 19
miw14 is an unknown quantity at this point
Re: URGENT:Auto Problem trying to fix before tomorrow

Quote:
Originally Posted by pblankenbaker View Post
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.
Reply With Quote
  #17   Spotlight this post!  
Unread 01-03-2014, 08:07
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
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.
__________________
"Never let your schooling interfere with your education" -Mark Twain
Reply With Quote
  #18   Spotlight this post!  
Unread 01-03-2014, 18:45
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 103
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
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.
Reply With Quote
Reply


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 11:29.

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