Problem with command group

Hey, I have a slight issue with command groups that I was wondering how to solve.
I want the elevator to go up while another system that’s slower than the elevator extends.
After that I need to run the motors for the cargo outtake, issue is that the cargo outtake doesnt wait for both the system and elevator commands to complete.
Our code looks something that:

Parallel: rotate wrist
Sequential: raise elevator
Sequential: outtake cargo

Any input on solving this would be great.
Thanks!

Put the wrist and elevator commands in another command group. Then add that as the sequential command in your first one.

Original:

Sequential: rotate wrist and raise elevator
Sequential: outtake cargo

New group:

Parallel: rotate wrist
Sequential: raise elevator
1 Like

How is your elevator completing its isFnished() command? Is it waiting until you’re at your setpoint before returning true?

1 Like

Putting the commands in another command group is what is is recommended here: http://wpilib.screenstepslive.com/s/currentCS/m/java/l/599743-synchronizing-two-commands

We experienced this last year too. We were directed to the command WaitForChildren(); We use java so I’m not 100% on the syntax for you.

Parallel: rotate wrist
Sequential: raise elevator
Sequential: WaitForChildren
Sequential: outtake cargo

+1

We do something like this just to keep it looking cleaner if you are only doing those actions once or twice (not in every mode)

addSequential(new CommandGroup() {
{
addParallel(new RotateWrist());
addSequential(new RaiseElevator());
}
});
addSequential(new OuttakeCargo());
`
-excuse my terrible formatting-

Yes.
Thank you all guys for all the ideas!

If you are using a PIDController to move the elevator and/or and wrist into position and all the commands do is set the setpoint and return true on isFinished()then the CommandGroup will immediately go on. The way to handle that would be to setup the PIDController so you can use the onTarget() method to know if you are at the position.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.