本文整理匯總了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();
}
示例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();
}
示例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();
}
}
示例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);
}
示例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);
}