當前位置: 首頁>>代碼示例>>Java>>正文


Java CommandGroup.addParallel方法代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.command.CommandGroup.addParallel方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandGroup.addParallel方法的具體用法?Java CommandGroup.addParallel怎麽用?Java CommandGroup.addParallel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.wpi.first.wpilibj.command.CommandGroup的用法示例。


在下文中一共展示了CommandGroup.addParallel方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: driveAndPrepareToShoot

import edu.wpi.first.wpilibj.command.CommandGroup; //導入方法依賴的package包/類
private static CommandGroup driveAndPrepareToShoot(boolean checkHot, double driveDistance, double timeToFinish, double timeout) {
        CommandGroup driveAndCheckGoal = new CommandGroup("driveAndCheck");
        driveAndCheckGoal.addSequential(driveForwardRotate(0, 0));
        driveAndCheckGoal.addParallel(setFingerPosition(ClawFingerSubsystem.DOWN));
        driveAndCheckGoal.addParallel(new SetClawWinchSolenoid(true));
        CommandGroup setClawPosition = new CommandGroup();
//        check the hot goal after .5 seconds
        if (checkHot) {
            driveAndCheckGoal.addSequential(new WaitCommand(500));
            driveAndCheckGoal.addSequential(new HotVisionWaitCommand());
            timeToFinish += 4.8;
        }
        final double minDriveSpeed = .7;

        ChangeableBoolean driveFinishedChecker = new ChangeableBoolean(false);
        driveAndCheckGoal.addParallel(new DriveSetDistanceWithPIDCommand(driveDistance, minDriveSpeed, driveFinishedChecker));
        driveAndCheckGoal.addSequential(new SetClawPosition(ClawPivotSubsystem.BACKWARD_SHOOT, driveFinishedChecker, timeToFinish), timeout);
        return driveAndCheckGoal;
    }
 
開發者ID:SaratogaMSET,項目名稱:649code2014,代碼行數:20,代碼來源:CommandBase.java

示例2: parseLine

import edu.wpi.first.wpilibj.command.CommandGroup; //導入方法依賴的package包/類
/**
 * Interprets a line as a Command and adds it to mCommands
 * 
 * @param aLine
 *            Line of text
 * @param b
 */
protected void parseLine(CommandGroup aGroup, String aLine, boolean aAddParallel)
{
    aLine = aLine.trim();
    if (aLine.isEmpty() || aLine.startsWith(mCommentStart))
    {
        return;
    }

    StringTokenizer tokenizer = new StringTokenizer(aLine, mDelimiter);

    List<String> args = new ArrayList<>();

    while (tokenizer.hasMoreElements())
    {
        args.add(tokenizer.nextToken());
    }

    Command newCommand = parseCommand(args);

    if (newCommand == null)
    {
        mSuccess = false;
    }
    else
    {
        if (aAddParallel)
        {
            aGroup.addParallel(newCommand);
        }
        else
        {
            aGroup.addSequential(newCommand);
        }
    }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:43,代碼來源:ACommandParser.java

示例3: twoBallShortDriveAutonomous

import edu.wpi.first.wpilibj.command.CommandGroup; //導入方法依賴的package包/類
public static Command twoBallShortDriveAutonomous() {
    CommandGroup mainAutonomousSequence = new CommandGroup("mainAutoSeq");
    mainAutonomousSequence.addSequential(driveAndPrepareToShoot(false, DriveTrainSubsystem.EncoderBasedDriving.AUTONOMOUS_DRIVE_DISTANCE_SHORT, 0, 1.6));
    mainAutonomousSequence.addSequential(shootBall(false));
    mainAutonomousSequence.addParallel(autoCoilClawWinch(), ClawWinchSubsystem.MAX_COIL_TIME);
    mainAutonomousSequence.addSequential(repositionAndPickup(DriveTrainSubsystem.EncoderBasedDriving.AUTONOMOUS_DRIVE_DISTANCE_SHORT));
    mainAutonomousSequence.addParallel(realignBall());
    mainAutonomousSequence.addSequential(driveAndPrepareToShoot(false, DriveTrainSubsystem.EncoderBasedDriving.AUTONOMOUS_DRIVE_DISTANCE_SHORT - 16, 9.2, 10));
    mainAutonomousSequence.addSequential(shootBall());
    return mainAutonomousSequence;
}
 
開發者ID:SaratogaMSET,項目名稱:649code2014,代碼行數:12,代碼來源:CommandBase.java

示例4: shootBall

import edu.wpi.first.wpilibj.command.CommandGroup; //導入方法依賴的package包/類
public static Command shootBall(boolean auto) {
    CommandGroup fireSequence = new CommandGroup();
    fireSequence.addParallel(setFingerPosition(ClawFingerSubsystem.UP));
    fireSequence.addParallel(new RunRollers(ClawRollerSubsystem.ROLLER_SPIN_SHOOT_SPEED));
    fireSequence.addSequential(new SetClawWinchSolenoid(false));
    fireSequence.addSequential(new WaitCommand(ClawWinchSubsystem.TIME_TO_FIRE));
    //then recoils
    fireSequence.addSequential(setFingerPosition(ClawFingerSubsystem.DOWN));
    fireSequence.addSequential(new RunRollers(ClawRollerSubsystem.ROLLER_SPIN_OFF_SPEED));
    if (auto) {
        fireSequence.addSequential(autoCoilClawWinch(), ClawWinchSubsystem.MAX_COIL_TIME);
    }
    return fireSequence;

}
 
開發者ID:SaratogaMSET,項目名稱:649code2014,代碼行數:16,代碼來源:CommandBase.java

示例5: run

import edu.wpi.first.wpilibj.command.CommandGroup; //導入方法依賴的package包/類
public void run() {
    TestCommand command1 = new TestCommand();
    TestCommand command2 = new TestCommand();
    
    CommandGroup commandGroup = new CommandGroup();
    commandGroup.addParallel(command1);
    commandGroup.addParallel(command2);
    
    
    assertCommandState(command1, 0, 0, 0, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    commandGroup.start();
    assertCommandState(command1, 0, 0, 0, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 0, 0, 0, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 1, 1, 0, 0);
    assertCommandState(command2, 1, 1, 1, 0, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 2, 2, 0, 0);
    assertCommandState(command2, 1, 2, 2, 0, 0);
    command1.setHasFinished(true);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 3, 3, 1, 0);
    assertCommandState(command2, 1, 3, 3, 0, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 3, 3, 1, 0);
    assertCommandState(command2, 1, 4, 4, 0, 0);
    command2.setHasFinished(true);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 3, 3, 1, 0);
    assertCommandState(command2, 1, 5, 5, 1, 0);
    
}
 
開發者ID:eshsrobotics,項目名稱:wpilib-java,代碼行數:37,代碼來源:CommandParallelGroupTest.java

示例6: autonomousInit

import edu.wpi.first.wpilibj.command.CommandGroup; //導入方法依賴的package包/類
/**
 * This function is called once at the start of autonomous mode.
 */
public void autonomousInit(){
    DriverStation driverStation = DriverStation.getInstance();
    double delayTime = driverStation.getAnalogIn(1);
    
    boolean trackHighGoal = driverStation.getDigitalIn(1);
    boolean trackMiddleGoal = driverStation.getDigitalIn(2);
    boolean shootInAuto = true;
    
    betweenModes();
    DrivetrainStrafe drivetrainStrafe = Components.getInstance().drivetrainStrafe;
    drivetrainStrafe.setDefaultCommand(new MaintainStateCommand(drivetrainStrafe));
    DrivetrainRotation drivetrainRotation = Components.getInstance().drivetrainRotation;
    drivetrainRotation.setDefaultCommand(new MaintainStateCommand(drivetrainRotation));
    
    CommandGroup fastAugerSequence = new CommandGroup();
    fastAugerSequence.addSequential(new PrintCommand("Dispensing auger"));
    fastAugerSequence.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
    fastAugerSequence.addSequential(new WaitCommand(0.8));
    
    CommandGroup augerSequence = new CommandGroup();
    augerSequence.addSequential(new PrintCommand("Dispensing auger"));
    augerSequence.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
    augerSequence.addSequential(new WaitCommand(2));
    
    CommandGroup firstAugerDrop = new CommandGroup();
    firstAugerDrop.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
    firstAugerDrop.addSequential(new WaitCommand(0.5));
    firstAugerDrop.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
    
    CommandGroup autoCommand = new CommandGroup();
    autoCommand.addSequential(new PrintCommand("Starting autonomous"));
    autoCommand.addSequential(new WaitCommand(delayTime));
    if(shootInAuto){
        autoCommand.addSequential(new FixedPointVisionTrackingCommand(FixedPointVisionTrackingCommand.PYRAMID_BACK_MIDDLE, TargetType.HIGH_GOAL), 4);
        autoCommand.addParallel(firstAugerDrop);
        autoCommand.addSequential(new SetShooterCommand(Shooter.SHOOTER_ON));
        autoCommand.addSequential(new WaitCommand(2));
        autoCommand.addSequential(new SetConveyorCommand(Conveyor.CONVEYOR_SHOOT_IN));
        autoCommand.addSequential(new WaitCommand(1));
        autoCommand.addSequential(new PrintCommand("Dispensing auger"));
        autoCommand.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
        autoCommand.addSequential(new WaitCommand(1.75));
        autoCommand.addSequential(new PrintCommand("Dispensing auger"));
        autoCommand.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
        autoCommand.addSequential(new WaitCommand(1.75));
        autoCommand.addSequential(new PrintCommand("Dispensing auger"));
        autoCommand.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
        autoCommand.addSequential(new WaitCommand(1.75));
        autoCommand.addSequential(new PrintCommand("Dispensing auger"));
        autoCommand.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
        autoCommand.addSequential(new WaitCommand(2));
        autoCommand.addSequential(new PrintCommand("Dispensing auger"));
        autoCommand.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
        autoCommand.addSequential(new WaitCommand(2));
        autoCommand.addSequential(new PrintCommand("Dispensing auger"));
        autoCommand.addSequential(new AugerRotateCommand(Auger.AugerDirection.AUGER_DOWN));
        autoCommand.addSequential(new WaitCommand(2));
        autoCommand.addSequential(new WaitForChildren());
        autoCommand.addSequential(new WaitCommand(2));
    }
    //autoCommand.addSequential(new RepeatCommand(new PrintCommand("Testing print"), 5));
    //autoCommand.addSequential(augerSequence, 5);
    
    autonomousCommand = autoCommand;
    autonomousCommand.start();
}
 
開發者ID:TheGreenMachine,項目名稱:Zed-Java,代碼行數:70,代碼來源:Zed.java


注:本文中的edu.wpi.first.wpilibj.command.CommandGroup.addParallel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。