当前位置: 首页>>代码示例>>Java>>正文


Java CommandGroup.start方法代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.command.CommandGroup.start方法的典型用法代码示例。如果您正苦于以下问题:Java CommandGroup.start方法的具体用法?Java CommandGroup.start怎么用?Java CommandGroup.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.wpi.first.wpilibj.command.CommandGroup的用法示例。


在下文中一共展示了CommandGroup.start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import edu.wpi.first.wpilibj.command.CommandGroup; //导入方法依赖的package包/类
/**
 * Calculates distance to travel and proper orientation then creates
 * DriveStraightADistance and TurnWithDegrees Commands, adds them to a
 * CommandGroup, then starts the CommandGroup.
 */
@Override
protected void initialize()
{

    mCommandGroup = new CommandGroup();
    mCurrentX = mPositioner.getXPosition();
    mCurrentY = mPositioner.getYPosition();
    mDriveDistance = Math.sqrt((Math.pow((mFinalXCoor - mCurrentX), 2)) + (Math.pow((mFinalYCoor - mCurrentY), 2)));
    mTurnDegrees = Math.toDegrees(Math.atan2((mFinalXCoor - mCurrentX), (mFinalYCoor - mCurrentY)));
    mTurnWithDegrees = new TurnWithDegrees(mDriveTrain, mPositioner, mTurnDegrees, mSpeed);
    System.out.println(mTurnDegrees);
    mDriveStraightADistance = new DriveStraightADistance(mDriveTrain, mPositioner, mDriveDistance, mSpeed);
    mCommandGroup.addSequential(mTurnWithDegrees);
    mCommandGroup.addSequential(mDriveStraightADistance);
    mCommandGroup.start();

}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:23,代码来源:GoToXY.java

示例2: autonomousInit

import edu.wpi.first.wpilibj.command.CommandGroup; //导入方法依赖的package包/类
public void autonomousInit() {
	 
	setBrakeMode(true);
    // schedule the autonomous command (example)
	//next two lines of code work for now, but we'll probably want to replace them with a more 
	//elegant way of selecting the auton mode we want from the smart dashboard 
	DriveEncoders.intializeEncoders();
	RobotMap.driveTrainRightFront.setPosition(0);
	RobotMap.driveTrainLeftFront.setPosition(0);
	System.out.print(auto.getSelected());
	autonomousCommand = (CommandGroup)new AutonCommandGroup (ParseInput.takeInput((String)auto.getSelected())); 
   
	if (autonomousCommand != null) autonomousCommand.start();
}
 
开发者ID:FRC2832,项目名称:Robot_2017,代码行数:15,代码来源:Robot.java

示例3: autonomousInit

import edu.wpi.first.wpilibj.command.CommandGroup; //导入方法依赖的package包/类
public void autonomousInit() {
     RobotMap.lightRing.set(Relay.Value.kOn);
 	RobotMap.winchMotor.enableBrakeMode(true);
 	if (recordedAuton) {
     	oi.gamepad.loadVirtualGamepad(recordedID);
 		oi.gamepad.startVirtualGamepad();
 	} else {
   // schedule the autonomous command (example)	
autonomousCommand = (CommandGroup) new ConstructedAutonomous(ParseInput.takeInput((String)auto_Movement.getSelected(), 
		(boolean)auto_Reverse.getSelected(), (int)auto_isHighGoal.getSelected()));
if(autonomousCommand != null)
	autonomousCommand.start();
 	}
 }
 
开发者ID:FRC2832,项目名称:Robot_2016,代码行数:15,代码来源:Robot.java

示例4: 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

示例5: run

import edu.wpi.first.wpilibj.command.CommandGroup; //导入方法依赖的package包/类
public void run() {
    final ASubsystem subsystem = new ASubsystem();


    TestCommand command1 = new TestCommand() {
        {
            requires(subsystem);
        }
    };
    
    TestCommand command2 = new TestCommand() {
        {
            requires(subsystem);
        }
    };
    
    TestCommand command3 = new TestCommand() {
        {
            requires(subsystem);
        }
    };
    
    CommandGroup commandGroup = new CommandGroup();
    commandGroup.addSequential(command1);
    commandGroup.addSequential(command2);
    commandGroup.addSequential(command3);
    
    
    assertCommandState(command1, 0, 0, 0, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    assertCommandState(command3, 0, 0, 0, 0, 0);
    commandGroup.start();
    assertCommandState(command1, 0, 0, 0, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    assertCommandState(command3, 0, 0, 0, 0, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 0, 0, 0, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    assertCommandState(command3, 0, 0, 0, 0, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 1, 1, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    assertCommandState(command3, 0, 0, 0, 0, 0);
    command1.setHasFinished(true);
    assertCommandState(command1, 1, 1, 1, 0, 0);
    assertCommandState(command2, 0, 0, 0, 0, 0);
    assertCommandState(command3, 0, 0, 0, 0, 0);
    
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 2, 2, 1, 0);
    assertCommandState(command2, 1, 1, 1, 0, 0);
    assertCommandState(command3, 0, 0, 0, 0, 0);
    command2.setHasFinished(true);
    assertCommandState(command1, 1, 2, 2, 1, 0);
    assertCommandState(command2, 1, 1, 1, 0, 0);
    assertCommandState(command3, 0, 0, 0, 0, 0);
    
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 2, 2, 1, 0);
    assertCommandState(command2, 1, 2, 2, 1, 0);
    assertCommandState(command3, 1, 1, 1, 0, 0);
    command3.setHasFinished(true);
    assertCommandState(command1, 1, 2, 2, 1, 0);
    assertCommandState(command2, 1, 2, 2, 1, 0);
    assertCommandState(command3, 1, 1, 1, 0, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 2, 2, 1, 0);
    assertCommandState(command2, 1, 2, 2, 1, 0);
    assertCommandState(command3, 1, 2, 2, 1, 0);
    Scheduler.getInstance().run();
    assertCommandState(command1, 1, 2, 2, 1, 0);
    assertCommandState(command2, 1, 2, 2, 1, 0);
    assertCommandState(command3, 1, 2, 2, 1, 0);
    
}
 
开发者ID:eshsrobotics,项目名称:wpilib-java,代码行数:76,代码来源:CommandSequentialGroupTest.java


注:本文中的edu.wpi.first.wpilibj.command.CommandGroup.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。