本文整理汇总了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();
*/
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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.");
}
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}