Go to Post *POP!* I suppose I'll have to change my hair style to the John V-Neun now. - Billfred [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
  #1   Spotlight this post!  
Unread 07-03-2014, 20:50
Tedi Tedi is offline
Registered User
FRC #4343
 
Join Date: Mar 2014
Location: Aurora
Posts: 3
Tedi is an unknown quantity at this point
Can isTimedOut() be used in a command group?

Hey guys,
So I was wondering if in the constructor of a command group (where addParallel and addSequential are added), can I also add setTimeout(x); and then check within the same command group if it has timed out? I am asking because I am unsure if setting a timeout inside a command group actually works or if it's only for commands.

Example:

Code:
public class cmdg extends CommandGroup {
    boolean A = false;
    public cmdg() {
        setTimeout(x);
        addSequential(command_here, x);
        if (isTimedOut()) {
            A = false;
        } else {
            A = true;
        }
        if (A) {
            //stuff here
        } else {
            //stuff here
        }
        
        
        
    }
}
Thanks,
Tedi

Last edited by Tedi : 07-03-2014 at 20:52.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-03-2014, 22:20
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Since CommandGroup extends Command, you can override isFinished. However CommandGroup isFinished implements a few checks, so you should make your isFinished be super.isFinished() || isTimedout() or you'll break the CommandGroup.
Reply With Quote
  #3   Spotlight this post!  
Unread 09-03-2014, 15:27
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Can isTimedOut() be used in a command group?

No. The constructor only runs once at robot initialization, so none of the commands should be timed out.
Reply With Quote
  #4   Spotlight this post!  
Unread 14-03-2014, 15:51
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Can isTimedOut() be used in a command group?

Quote:
Originally Posted by Arhowk View Post
No. The constructor only runs once at robot initialization, so none of the commands should be timed out.
To reiterate this....

The only way to use isTimedOut is to first use seTimeOut within the command, or command group.

If you use the 2 paramter constructor to set the timeout value, this is never seen by the command, instead I believe it is passed to the scheduler to be killed.

So isTimedOut will always return false, unless you exlicitly set the timeout within the command itself.

Is that clear?

Hope this helps,
Kevin
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
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 12:36.

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