Go to Post Each year that I've been on the team I've thought to myself, "Man we lost some great seniors this year," and each year younger students have stepped up on their own to fill those leadership positions. - BJC [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 03-03-2015, 21:55
VaneRaklan VaneRaklan is offline
Registered User
FRC #2557 (The SOTABots)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2014
Location: Tacoma, WA
Posts: 17
VaneRaklan is an unknown quantity at this point
Autonomous: addParallel

So we are trying to run parallels in our autonomous, but for some reason when we add a parallel to the mix, that command won't run until after every other sequential command has finished. Any ideas for why this would happen? If someone could put up an example of a simple, working, auto code that uses parallels, t that would be great.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-03-2015, 22:13
TFleig78's Avatar
TFleig78 TFleig78 is offline
Registered User
AKA: Tyler
FRC #0078 (Air Strike)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Rhode Island
Posts: 58
TFleig78 will become famous soon enoughTFleig78 will become famous soon enough
Re: Autonomous: addParallel

I believe a parallel command won't run until the sequential command above it has finished. if you want two things to happen simultaneously, make the first one parallel.

This is a snippet of our code from last year:

Code:
          addSequential(new ShootAndReloadBall());
          addSequential(new WaitCommand(0.75));
          addParallel(new IntakeFastStore());
          addParallel(new DriveStraight(DRIVE_SPEED, DRIVE_TIME));
The last two commands execute at the same time.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-03-2015, 03:31
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: Autonomous: addParallel

Just to make sure everything is clear.
Code:
          addSequential(new ShootAndReloadBall());
          addSequential(new WaitCommand(0.75));
          addParallel(new IntakeFastStore());
          addSequential(new DriveStraight(DRIVE_SPEED, DRIVE_TIME));
Will also have the last two commands run at the same time.

The addX() functions basically apply to handling the next command's execution order.
__________________
Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group

2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
Reply With Quote
  #4   Spotlight this post!  
Unread 04-03-2015, 07:36
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: Autonomous: addParallel

Deleting my post because I was wrong in several of my assumptions.

Thanks Matt for correcting me.

Needless to say, adding parallel commands can certainly make your head spin.

Good luck!
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 04-03-2015 at 11:19.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-03-2015, 10:46
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: Autonomous: addParallel

Quote:
If we convert this into the translated syntax you'll come up with this.

Code:
[2|1]
[3]
[4]
What you'll notice is that 1 will only execute as only as 2 executes. If 2 finishes, 1 also finishes, even if it's not done.
Looking at the source code for CommandGroups I do not believe this is the case. Command 1 will run until another command that requires the same subsystem interrupts it or it finishes on its own.

Quote:
So when you are implementing a series of parallel commands in a command group they need to be followed by the sequential command which acts as the control for the command.

Code:
addParrallel(1);
addParrallel(2);
addSequential(3);
In this case the command group will run until 3 finishes.
I also do not believe this is the case. The CommandGroup will not finish until all commands it contains are finished.

Last edited by notmattlythgoe : 04-03-2015 at 10:51.
Reply With Quote
  #6   Spotlight this post!  
Unread 05-03-2015, 14:12
shindigo shindigo is offline
Registered User
AKA: Mike Parker
FRC #0102
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2009
Location: Somerville, NJ
Posts: 33
shindigo is an unknown quantity at this point
Re: Autonomous: addParallel

We put all our sets of parallel commands in their own CommandGroup. We find this makes is clearer what is running in parallel and what is not.

In the Autonomous CommandGroup we have:
AddSequential(new DoThing1());
AddSequential(new DoThings2and3());
AddSequential(new DoThing4());

Inside the CommandGroup called DoThings2and3 we have:

AddParallel(new DoThing2());
AddParallel(new DoThing3());

Thing4 does not execute until 2 and 3 are finished.
Reply With Quote
  #7   Spotlight this post!  
Unread 05-03-2015, 14:16
Ty Tremblay's Avatar
Ty Tremblay Ty Tremblay is offline
Robotics Engineer
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Alton NH
Posts: 822
Ty Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond repute
Re: Autonomous: addParallel

It's a little counter intuitive at first, but addParallel() commands run in parallel with the first addSequential() AFTER them.

Code:
addParallel(1)
addParallel(2)
addSequential(1)  //All 3 commands run

addSequential(1)
addParallel(1)
addParallel(2)
addSequential(2) //sequential 1 will run, then parallels 1&2 will run with sequential 2
__________________
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:27.

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