当前位置: 首页>>代码示例>>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;未经允许,请勿转载。