Go to Post FIRST is again mirroring real life. And in real life, when we build and design robotic and automated systems, it's safety first. Hitting a human in real life loses a lot more than 30 points. - Fred Agnir [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 16-11-2015, 11:39
SamCarlberg's Avatar
SamCarlberg SamCarlberg is offline
GRIP, WPILib. 2084 alum
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 103
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
Yeah, I doubted anything additional would make it in this year. I meant more for future years.
Maybe. It doesn't seem like a huge project but it might not be a priority for next year
Reply With Quote
  #17   Spotlight this post!  
Unread 16-11-2015, 11:48
SamCarlberg's Avatar
SamCarlberg SamCarlberg is offline
GRIP, WPILib. 2084 alum
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 103
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
  #18   Spotlight this post!  
Unread 16-11-2015, 12:00
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is online now
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,722
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
  #19   Spotlight this post!  
Unread 16-11-2015, 12:11
SamCarlberg's Avatar
SamCarlberg SamCarlberg is offline
GRIP, WPILib. 2084 alum
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Nov 2015
Rookie Year: 2009
Location: MA
Posts: 103
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
  #20   Spotlight this post!  
Unread 16-11-2015, 17:45
randallh randallh is offline
Registered User
FRC #4931
 
Join Date: Oct 2015
Location: Greater St. Louis area
Posts: 15
randallh is on a distinguished road
Re: Java Conditional Command

Quote:
Originally Posted by notmattlythgoe View Post
Yeah, I should have set the first command as parallel not sequential. I like the lambda ideas. Going to have to play around with them.
If you've not already seen Strongback, you may want to take a look since its command framework (which we think is improved over WPILib's) uses lambdas throughout. In fact, it uses lambdas throughout the whole API.

See the announcement on CD, and the Using Strongback online book.

Best regards
Reply With Quote
  #21   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: 578
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
  #22   Spotlight this post!  
Unread 16-11-2015, 19:21
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is online now
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,722
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 11:52.

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