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


Java Command.start方法代碼示例

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


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

示例1: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
/**
 * This autonomous (along with the chooser code above) shows how to select
 * between different autonomous modes using the dashboard. The sendable
 * chooser code works with the Java SmartDashboard. If you prefer the
 * LabVIEW Dashboard, remove all of the chooser code and uncomment the
 * getString code to get the auto name from the text box below the Gyro
 *
 * You can add additional auto modes by adding additional commands to the
 * chooser code above (like the commented example) or additional comparisons
 * to the switch structure below with additional strings & commands.
 */
@Override
public void autonomousInit() {
	mAutonomousCommand = (Command) autoChooser.getSelected();
	//mAutonomousCommand.start();
	if (mAutonomousCommand != null)
		mAutonomousCommand.start();
	/*
	 * String autoSelected = SmartDashboard.getString("Auto Selector",
	 * "Default"); switch(autoSelected) { case "My Auto": autonomousCommand
	 * = new MyAutoCommand(); break; case "Default Auto": default:
	 * autonomousCommand = new ExampleCommand(); break; }
	 */

	/*
	// schedule the autonomous command (example)
	if (autonomousCommand != null)
		autonomousCommand.start();
	*/
}
 
開發者ID:FRC6706,項目名稱:FRC6706_JAVA2017,代碼行數:31,代碼來源:Robot.java

示例2: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
/**
 * This autonomous (along with the chooser code above) shows how to select
 * between different autonomous modes using the dashboard. The sendable
 * chooser code works with the Java SmartDashboard. If you prefer the
 * LabVIEW Dashboard, remove all of the chooser code and uncomment the
 * getString code to get the auto name from the text box below the Gyro
 *
 * You can add additional auto modes by adding additional commands to the
 * chooser code above (like the commented example) or additional comparisons
 * to the switch structure below with additional strings & commands.
 */
// @Override
public void autonomousInit() {

	// DEBUG \\
	if (RobotConstants.isTestingEnvironment) readTestingEnvironment();
	
	// resets sensors
	resetAllSensors();
	
	autonomousCommand = (Command) autoChooser.getSelected();

	// schedule the autonomous command (example)
	if (autonomousCommand != null)
		autonomousCommand.start();
}
 
開發者ID:Team4914,項目名稱:2017-emmet,代碼行數:27,代碼來源:Robot.java

示例3: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
/**
 * This autonomous (along with the chooser code above) shows how to select
 * between different autonomous modes using the dashboard. The sendable
 * chooser code works with the Java CustomDashboard. If you prefer the
 * LabVIEW Dashboard, remove all of the chooser code and uncomment the
 * getString line to get the auto name from the text box below the Gyro
 *
 * You can add additional auto modes by adding additional comparisons to the
 * switch structure below with additional strings. If using the
 * SendableChooser make sure to add them to the chooser code above as well.
 */
@Override
public void autonomousInit() {
	driveTrain.resetEncoders();
	driveTrain.resetGyro();
	
	autoSelected = (Command) chooser.getSelected();
	if(autoSelected instanceof Initializer) {
		((Initializer)autoSelected).init();
	}
	autoSelected.start();
	// autoSelected = CustomDashboard.getString("Auto Selector",
	// defaultAuto);
	System.out.println("Auto selected: " + autoSelected);
	pollPreferences();
}
 
開發者ID:Team997Coders,項目名稱:2017SteamBot2,代碼行數:27,代碼來源:Robot.java

示例4: teleopInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
public void teleopInit() {
	// This makes sure that the autonomous stops running when
	// teleop starts running. If you want the autonomous to
	// continue until interrupted by another command, remove
	// this line or comment it out.
	if (autonomousCommand != null) {
		autonomousCommand.cancel();
	}
	if (Robot.catapult.getPreviousShooterState() != 0) {
		Robot.catapult.setShooterState(Robot.catapult.getPreviousShooterState());
		Command cmd1 = new Shoot();
		cmd1.start();
		
	}
	Robot.robotDrive.setIsInAuto(false);
}
 
開發者ID:Woodland4678,項目名稱:Cybercavs2016Code,代碼行數:17,代碼來源:Robot.java

示例5: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
/**
* This autonomous (along with the chooser code above) shows how to select between different autonomous modes
* using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
* Dashboard, remove all of the chooser code and uncomment the getString code to get the auto name from the text box
* below the Gyro
*
* You can add additional auto modes by adding additional commands to the chooser code above (like the commented example)
* or additional comparisons to the switch structure below with additional strings & commands.
*/
  public void autonomousInit() {
      autonomousCommand = (Command) chooser.getSelected();
      
/* String autoSelected = SmartDashboard.getString("Auto Selector", "Default");
switch(autoSelected) {
case "My Auto":
	autonomousCommand = new MyAutoCommand();
	break;
case "Default Auto":
default:
	autonomousCommand = new ExampleCommand();
	break;
} */
  	
  	// schedule the autonomous command (example)
      if (autonomousCommand != null) autonomousCommand.start();
      
      belowLowBar.start();
  }
 
開發者ID:CraftSpider,項目名稱:Stronghold2016-340,代碼行數:29,代碼來源:Robot.java

示例6: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
/**
* This autonomous (along with the chooser code above) shows how to select between different autonomous modes
* using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
* Dashboard, remove all of the chooser code and uncomment the getString code to get the auto name from the text box
* below the Gyro
*
* You can add additional auto modes by adding additional commands to the chooser code above (like the commented example)
* or additional comparisons to the switch structure below with additional strings & commands.
*/
  public void autonomousInit() {
      autonomousCommand = (Command) chooser.getSelected();
      
/* String autoSelected = SmartDashboard.getString("Auto Selector", "Default");
switch(autoSelected) {
case "My Auto":
	autonomousCommand = new MyAutoCommand();
	break;
case "Default Auto":
default:
	autonomousCommand = new ExampleCommand();
	break;
} */
  	
  	// schedule the autonomous command (example)
      if (autonomousCommand != null) autonomousCommand.start();
  }
 
開發者ID:CraftSpider,項目名稱:Stronghold2016-340,代碼行數:27,代碼來源:Robot.java

示例7: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
public void autonomousInit() {
	// Use the selected autonomous command

	autonomousCommand = (Command) oi.autonomousProgramChooser.getSelected();
	//double desiredDistrance = preferences.getDouble("DesiredDistance", 9.0);
	//autonomousCommand = new AutonomousCommandToteStrategy();
	//autonomousCommand = new StrafeCommand(3, 0.7);
	//double desiredDistance = preferences.getDouble("DesiredDistance", 9.0);
	//autonomousCommand = new AutonomousCommandToteStrategy();

	// Sets the setPoint to where-ever it is to prevent the elevator
	// wanting to go to a random position (default zero)
	elevator.setHieghtToCurrentPosition();
	// Tells the elevator to approximate the other maximum when it hits a limit switch
	Elevator.SAFETY = true;
	Elevator.needToApproximate = true;
	Elevator.didSaveTopValue = false;
	Elevator.didSaveBottomValue = false;
	driveTrain.fieldMode = false;
	autonomousCommand.start();
}
 
開發者ID:Spartronics4915,項目名稱:2015-Recycle-Rush,代碼行數:22,代碼來源:Robot.java

示例8: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
public void autonomousInit() {
	
	toteCollectTime = prefs.getDouble("toteTimeout", 1.0);
	driveToAutoTime = prefs.getDouble("timeToAutozone", 4.0);
	driveToAutoSpeed = prefs.getFloat("driveSpeedToScore", -0.8f);
	driveToBinTime = prefs.getDouble("timeToBin", 1.0);
	driveToBinSpeed = prefs.getFloat("driveToBinSpeed", -0.5f);
	elevateToteTime = prefs.getDouble("timeToElevateTote", 1.0);
	rollersEjectTime = prefs.getDouble("timeForRollersToEject", 1.0);
	timeToGroundLevel = prefs.getDouble("timeToGroundLevel", 1.0);
	turnToAutoTime = prefs.getDouble("timeToTurnToAutoZone", 1.0);
	turnToAutoSpeed = prefs.getFloat("speedToTurnToAutoZone", 0.5f);
	binLiftTime = prefs.getDouble("timeToLiftBin", 1.0);
	clawOpenOnElevMove = prefs.getBoolean("clawOpenALot", true);
	clawCloseOnElevMove = prefs.getBoolean("clawCloseALot", true);
	prefs.save();
	
    // schedule the autonomous command (example)
	autonomousCommand = (Command) chooser.getSelected();
    if (autonomousCommand != null) autonomousCommand.start();
}
 
開發者ID:FRCTeam1073-TheForceTeam,項目名稱:robot15,代碼行數:22,代碼來源:Robot.java

示例9: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
public void autonomousInit() {
//        // Last ditch effort to bring the camera up on the DS laptop, probably
//        // is too late.
//        TargetTrackingCommunication.setCameraEnabled(true);
//        // Tell the DS laptop to starting detecting the hot target
//        TargetTrackingCommunication.setAutonomousVisionRunning(true);
//        Removed this and put it in the autonomous command
//        Robot.driveSubsystem.getRobotDrive().resetGyro();

        // Pick which autonomous mode to use.
        Object selection = autonomousChooser.getSelected();
        if (selection != null && selection instanceof Command) {
            autonomousCommand = (Command) selection;
            autonomousCommand.start();
        } else {
            System.out.println("No autonomous mode selected.");
        }
    }
 
開發者ID:RobotsByTheC,項目名稱:CMonster2014,代碼行數:19,代碼來源:Robot.java

示例10: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
/**
 * This function is called once when autonomous operation begins.
 */
public void autonomousInit() {
    print("Entering autonomous mode");

    // Use this command as the default ...
    Command autonomousCommand = new DriveForwardAndBackward();
    if (autonomousCommandChooser != null) {
        // Decide via the SmartDashboard which autonomous command we should use ...
        try {
            Command selected = (Command)autonomousCommandChooser.getSelected();
            if (selected != null) autonomousCommand = selected;
        } catch (NullPointerException e) {
            // This happens when there is no SmartDashboard running
        }
    }
    print("Starting autonomous operation " + autonomousCommand.getName() + "...");
    autonomousCommand.start();
}
 
開發者ID:frc-4931,項目名稱:2014-Robot,代碼行數:21,代碼來源:Robot.java

示例11: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
@Override
public void autonomousInit() {
	//Robot.leds.turnOff(4);
//	Robot.leds.turnOn(Robot.leds.ledAuto);
	if (teleop != null) {
		teleop.cancel();
	}
	autonomousCommand = (Command) chooser.getSelected();
	if (autonomousCommand != null) {
		Robot.gear.startComp();
		autonomousCommand.start();
	}
}
 
開發者ID:2729StormRobotics,項目名稱:StormRobotics2017,代碼行數:14,代碼來源:Robot.java

示例12: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
@Override
public void autonomousInit() {
	// schedule the autonomous command (example)
	autonomousCommand = (Command) autoChooser.getSelected();
	if (autonomousCommand != null)
		autonomousCommand.start();
}
 
開發者ID:chopshop-166,項目名稱:frc-2016,代碼行數:8,代碼來源:Robot.java

示例13: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
public void autonomousInit() {
// schedule the autonomous command (example)
  	autonomousCommand = (Command) autoChooser.getSelected();
  	autonomousCommand.start();
  	if (autonomousCommand != null) autonomousCommand.start();
  	
  }
 
開發者ID:newheights,項目名稱:RobotBuilderTest,代碼行數:8,代碼來源:Robot.java

示例14: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
/**
	 * This autonomous (along with the chooser code above) shows how to select between different autonomous modes
	 * using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
	 * Dashboard, remove all of the chooser code and uncomment the getString code to get the auto name from the text box
	 * below the Gyro
	 *
	 * You can add additional auto modes by adding additional commands to the chooser code above (like the commented example)
	 * or additional comparisons to the switch structure below with additional strings & commands.
	 */
    public void autonomousInit() {
        autonomousCommand = (Command) chooser.getSelected();
    	
    	// schedule the autonomous command (example)
        if (autonomousCommand != null) autonomousCommand.start();
    	
    	//Calibrates Gyro at beginning of auto.
//        drive.calibrateGyro();
    	
//    	belowLowBar = new CG_AutoLowBar();
//        belowLowBar.start();
    }
 
開發者ID:CraftSpider,項目名稱:Stronghold2016-340,代碼行數:22,代碼來源:Robot.java

示例15: autonomousInit

import edu.wpi.first.wpilibj.command.Command; //導入方法依賴的package包/類
public void autonomousInit() {
    // schedule the autonomous command (example)
    //if (autonomousCommand != null) autonomousCommand.start();
	autonomousCommand = (Command) autoChooser.getSelected();
	autonomousCommand.start();
  
}
 
開發者ID:TEAM4456,項目名稱:MechStorm2016,代碼行數:8,代碼來源:Robot.java


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