mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Move GroupedCommands to CommandScheduler (#4728)
Move the command group checking functionality from CommandGroupBase into CommandScheduler. Update references to grouping as composition for clarity (because explicitly grouping isn't the only way to do it). Deprecate the static factory methods parallel, race, and deadline in CommandGroupBase in favor of the identical ones in Commands.
This commit is contained in:
@@ -8,6 +8,7 @@ import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Claw;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Drivetrain;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Elevator;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Wrist;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
|
||||
/** The main autonomous command to pickup and deliver the soda to the box. */
|
||||
@@ -22,6 +23,6 @@ public class Autonomous extends SequentialCommandGroup {
|
||||
new Place(claw, wrist, elevator),
|
||||
new SetDistanceToBox(0.60, drive),
|
||||
// new DriveStraight(-2), // Use Encoders if ultrasonic is broken
|
||||
parallel(new SetWristSetpoint(-45, wrist), new CloseClaw(claw)));
|
||||
Commands.parallel(new SetWristSetpoint(-45, wrist), new CloseClaw(claw)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package edu.wpi.first.wpilibj.examples.gearsbot.commands;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Claw;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Elevator;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Wrist;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,7 @@ public class Pickup extends SequentialCommandGroup {
|
||||
public Pickup(Claw claw, Wrist wrist, Elevator elevator) {
|
||||
addCommands(
|
||||
new CloseClaw(claw),
|
||||
parallel(new SetWristSetpoint(-45, wrist), new SetElevatorSetpoint(0.25, elevator)));
|
||||
Commands.parallel(
|
||||
new SetWristSetpoint(-45, wrist), new SetElevatorSetpoint(0.25, elevator)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package edu.wpi.first.wpilibj.examples.gearsbot.commands;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Claw;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Elevator;
|
||||
import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Wrist;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
|
||||
/** Make sure the robot is in a state to pickup soda cans. */
|
||||
@@ -21,6 +22,6 @@ public class PrepareToPickup extends SequentialCommandGroup {
|
||||
public PrepareToPickup(Claw claw, Wrist wrist, Elevator elevator) {
|
||||
addCommands(
|
||||
new OpenClaw(claw),
|
||||
parallel(new SetWristSetpoint(0, wrist), new SetElevatorSetpoint(0, elevator)));
|
||||
Commands.parallel(new SetWristSetpoint(0, wrist), new SetElevatorSetpoint(0, elevator)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.rapidreactcommandbot;
|
||||
|
||||
import static edu.wpi.first.wpilibj2.command.CommandGroupBase.parallel;
|
||||
import static edu.wpi.first.wpilibj2.command.Commands.parallel;
|
||||
|
||||
import edu.wpi.first.wpilibj.examples.rapidreactcommandbot.Constants.AutoConstants;
|
||||
import edu.wpi.first.wpilibj.examples.rapidreactcommandbot.Constants.OIConstants;
|
||||
|
||||
Reference in New Issue
Block a user