Go to Post "What we really need to make sure we do is make our robot move." - Barngirl425 [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 15-11-2015, 14:34
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,561
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
Re: Java Conditional Command

In this particular case of the example, I think it would be easier to build the logic into a single command.

However, the pattern is definitely useful. We had cases last year where we wanted to start a parallel command halfway through another command (for a different subsytem). We sequenced them with waits, but a way to generically peek at the progress of the first command would be much better.
Reply With Quote
  #2   Spotlight this post!  
Unread 16-11-2015, 11:48
SamCarlberg's Avatar
SamCarlberg SamCarlberg is online now
GRIP, WPILib. 2084 alum
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 54
SamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to behold
Re: Java Conditional Command

Quote:
Originally Posted by Joe Ross View Post
In this particular case of the example, I think it would be easier to build the logic into a single command.

However, the pattern is definitely useful. We had cases last year where we wanted to start a parallel command halfway through another command (for a different subsytem). We sequenced them with waits, but a way to generically peek at the progress of the first command would be much better.
If you just want a rising/falling edge trigger, you could just poll the isFinished() method of the previous command, though that would break the CommandGroup paradigm a little
Reply With Quote
  #3   Spotlight this post!  
Unread 16-11-2015, 12:00
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,715
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Java Conditional Command

Quote:
Originally Posted by SamCarlberg View Post
If you just want a rising/falling edge trigger, you could just poll the isFinished() method of the previous command, though that would break the CommandGroup paradigm a little
I've written one off wait for specific value commands that basically do the same thing the initial thread was started about. Things like having the robot move at a certain speed and when it reaches certain distances fire off certain commands. Think 7 disc auto in 2013. Never needed to stop, but as you reached the certain distances you could activate a certain chain of events.

What is the CommandGroup paradigm for doing down a different command path based on a decision from a previous step? Think hot goals in 2014.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-11-2015, 12:11
SamCarlberg's Avatar
SamCarlberg SamCarlberg is online now
GRIP, WPILib. 2084 alum
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 54
SamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to beholdSamCarlberg is a splendid one to behold
Re: Java Conditional Command

Quote:
Originally Posted by notmattlythgoe View Post
I've written one off wait for specific value commands that basically do the same thing the initial thread was started about. Things like having the robot move at a certain speed and when it reaches certain distances fire off certain commands. Think 7 disc auto in 2013. Never needed to stop, but as you reached the certain distances you could activate a certain chain of events.

What is the CommandGroup paradigm for doing down a different command path based on a decision from a previous step? Think hot goals in 2014.
Sounds a lot like an event/listener model.

That's not how CommandGroups were intended to be used, which is why it breaks the paradigm.
Reply With Quote
  #5   Spotlight this post!  
Unread 15-11-2015, 14:45
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,574
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Java Conditional Command

My Java is a bit rusty, but won't this command in the DriveToLine instantiator:

Code:
        addSequential(waitUntil(drivetrain.getDistance(), GREATER_THAN, 50));
Get the distance from the drivetrain once during the instantiator, rather than sending a handle for the drivetrain.getDistance method to waitUntil()?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #6   Spotlight this post!  
Unread 16-11-2015, 17:56
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 575
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: Java Conditional Command

Quote:
Originally Posted by notmattlythgoe View Post
Code:
    	addSequential(new DriveCommand(0.5));
        addSequential(waitUntil(drivetrain.getDistance(), GREATER_THAN, 50));
        addSequential(new DriveCommand(0));
How do I describe what the robot should do if the distance never exceeds 50?
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
Reply With Quote
  #7   Spotlight this post!  
Unread 16-11-2015, 19:21
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,715
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Java Conditional Command

Quote:
Originally Posted by MrRoboSteve View Post
How do I describe what the robot should do if the distance never exceeds 50?
If you're expecting it to timeout you could just call the addSequential() that takes a timeout parameter also.
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 10:16.

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