本文整理汇总了Java中edu.wpi.first.wpilibj.livewindow.LiveWindow.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java LiveWindow.setEnabled方法的具体用法?Java LiveWindow.setEnabled怎么用?Java LiveWindow.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.livewindow.LiveWindow
的用法示例。
在下文中一共展示了LiveWindow.setEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPeriodic
import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
public void testPeriodic() {
LiveWindow.setEnabled(false);
// // Get the Command
// SmartDashboard.putData("Test Mode Commands", testCommands);
// if(testCommands.getSelected() == TEST_COMMANDS.DRIVE_LEFT) {
// HardwareAdapter.kDriveLeft1.set(1);
// HardwareAdapter.kDriveLeft2.set(1);
// HardwareAdapter.kDriveLeft3.set(1);
//
// HardwareAdapter.kDriveRight1.set(0);
// HardwareAdapter.kDriveRight2.set(0);
// HardwareAdapter.kDriveRight3.set(0);
// } else if(testCommands.getSelected() == TEST_COMMANDS.DRIVE_RIGHT) {
// HardwareAdapter.kDriveLeft1.set(0);
// HardwareAdapter.kDriveLeft2.set(0);
// HardwareAdapter.kDriveLeft3.set(0);
//
// HardwareAdapter.kDriveRight1.set(1);
// HardwareAdapter.kDriveRight2.set(1);
// HardwareAdapter.kDriveRight3.set(1);
// } else {
// HardwareAdapter.kDriveLeft1.set(0);
// HardwareAdapter.kDriveLeft2.set(0);
// HardwareAdapter.kDriveLeft3.set(0);
//
// HardwareAdapter.kDriveRight1.set(0);
// HardwareAdapter.kDriveRight2.set(0);
// HardwareAdapter.kDriveRight3.set(0);
// }
// PDP
SmartDashboard.putData("PDP", pdp);
// Drive Data
// SmartDashboard.putData("Drive Left 1", HardwareAdapter.kDriveLeft1);
// SmartDashboard.putData("Drive Left 2", HardwareAdapter.kDriveLeft2);
// SmartDashboard.putData("Drive Left 3", HardwareAdapter.kDriveLeft3);
// SmartDashboard.putData("Drive Right 1", HardwareAdapter.kDriveRight1);
// SmartDashboard.putData("Drive Right 2", HardwareAdapter.kDriveRight2);
// SmartDashboard.putData("Drive Right 3", HardwareAdapter.kDriveRight3);
SmartDashboard.putData("Drive Left Encoder", HardwareAdapter.kDriveLeftEncoder);
SmartDashboard.putData("Drive Right Encoder", HardwareAdapter.kDriveRightEncoder);
// Shooter Data
// SmartDashboard.putData("Shooter Lift", HardwareAdapter.kShooterLift);
// SmartDashboard.putData("Shooter Left", HardwareAdapter.kShooterLeft);
// SmartDashboard.putData("Shooter Right", HardwareAdapter.kShooterRight);
SmartDashboard.putNumber("Shooter Lift Position", HardwareAdapter.kShooterLift.getPosition());
SmartDashboard.putNumber("Shooter Left RPM", HardwareAdapter.kShooterLeft.getSpeed());
SmartDashboard.putNumber("Shooter Right RPM", HardwareAdapter.kShooterRight.getSpeed());
// Intake Data
// SmartDashboard.putData("Intake Artic", HardwareAdapter.kIntakeArtic);
// SmartDashboard.putData("Intake Rollers", HardwareAdapter.kIntakeRollers);
SmartDashboard.putNumber("Intake Position", HardwareAdapter.kIntakeArtic.getPosition());
SmartDashboard.putNumber("Intake RPM", HardwareAdapter.kIntakeRollers.getSpeed());
// shooter.setOuterWorksAngle(SmartDashboard.getNumber("OuterWorks"));
// shooter.setOffBatterAngle(SmartDashboard.getNumber("OffBatter"));
// shooter.setBatterAngle(SmartDashboard.getNumber("Batter"));
Commands c = driverInput.update();
teleop.update(c);
}
示例2: startCompetition
import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
/**
* Start a competition. This code tracks the order of the field starting to ensure that everything
* happens in the right order. Repeatedly run the correct method, either Autonomous or
* OperatorControl when the robot is enabled. After running the correct method, wait for some
* state to change, either the other mode starts or the robot is disabled. Then go back and wait
* for the robot to be enabled again.
*/
public void startCompetition() {
HAL.report(tResourceType.kResourceType_Framework,
tInstances.kFramework_Simple);
robotInit();
// Tell the DS that the robot is ready to be enabled
HAL.observeUserProgramStarting();
robotMain();
if (!m_robotMainOverridden) {
// first and one-time initialization
LiveWindow.setEnabled(false);
while (true) {
if (isDisabled()) {
m_ds.InDisabled(true);
disabled();
m_ds.InDisabled(false);
while (isDisabled()) {
Timer.delay(0.01);
}
} else if (isAutonomous()) {
m_ds.InAutonomous(true);
autonomous();
m_ds.InAutonomous(false);
while (isAutonomous() && !isDisabled()) {
Timer.delay(0.01);
}
} else if (isTest()) {
LiveWindow.setEnabled(true);
m_ds.InTest(true);
test();
m_ds.InTest(false);
while (isTest() && isEnabled()) {
Timer.delay(0.01);
}
LiveWindow.setEnabled(false);
} else {
m_ds.InOperatorControl(true);
operatorControl();
m_ds.InOperatorControl(false);
while (isOperatorControl() && !isDisabled()) {
Timer.delay(0.01);
}
}
} /* while loop */
}
}
示例3: startCompetition
import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
/**
* Provide an alternate "main loop" via startCompetition().
*/
public void startCompetition() {
HAL.report(tResourceType.kResourceType_Framework,
tInstances.kFramework_Iterative);
robotInit();
// Tell the DS that the robot is ready to be enabled
HAL.observeUserProgramStarting();
// loop forever, calling the appropriate mode-dependent function
LiveWindow.setEnabled(false);
while (true) {
// Wait for new data to arrive
m_ds.waitForData();
// Call the appropriate function depending upon the current robot mode
if (isDisabled()) {
// call DisabledInit() if we are now just entering disabled mode from
// either a different mode or from power-on
if (!m_disabledInitialized) {
LiveWindow.setEnabled(false);
disabledInit();
m_disabledInitialized = true;
// reset the initialization flags for the other modes
m_autonomousInitialized = false;
m_teleopInitialized = false;
m_testInitialized = false;
}
HAL.observeUserProgramDisabled();
disabledPeriodic();
} else if (isTest()) {
// call TestInit() if we are now just entering test mode from either
// a different mode or from power-on
if (!m_testInitialized) {
LiveWindow.setEnabled(true);
testInit();
m_testInitialized = true;
m_autonomousInitialized = false;
m_teleopInitialized = false;
m_disabledInitialized = false;
}
HAL.observeUserProgramTest();
testPeriodic();
} else if (isAutonomous()) {
// call Autonomous_Init() if this is the first time
// we've entered autonomous_mode
if (!m_autonomousInitialized) {
LiveWindow.setEnabled(false);
// KBS NOTE: old code reset all PWMs and relays to "safe values"
// whenever entering autonomous mode, before calling
// "Autonomous_Init()"
autonomousInit();
m_autonomousInitialized = true;
m_testInitialized = false;
m_teleopInitialized = false;
m_disabledInitialized = false;
}
HAL.observeUserProgramAutonomous();
autonomousPeriodic();
} else {
// call Teleop_Init() if this is the first time
// we've entered teleop_mode
if (!m_teleopInitialized) {
LiveWindow.setEnabled(false);
teleopInit();
m_teleopInitialized = true;
m_testInitialized = false;
m_autonomousInitialized = false;
m_disabledInitialized = false;
}
HAL.observeUserProgramTeleop();
teleopPeriodic();
}
robotPeriodic();
}
}
示例4: startCompetition
import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
/**
* Start a competition. This code tracks the order of the field starting to
* ensure that everything happens in the right order. Repeatedly run the
* correct method, either Autonomous or OperatorControl when the robot is
* enabled. After running the correct method, wait for some state to change,
* either the other mode starts or the robot is disabled. Then go back and
* wait for the robot to be enabled again.
*/
public void startCompetition() {
UsageReporting.report(tResourceType.kResourceType_Framework, tInstances.kFramework_Sample);
robotInit();
// Tell the DS that the robot is ready to be enabled
FRCNetworkCommunicationsLibrary.FRCNetworkCommunicationObserveUserProgramStarting();
robotMain();
if (!m_robotMainOverridden) {
// first and one-time initialization
LiveWindow.setEnabled(false);
while (true) {
if (isDisabled()) {
m_ds.InDisabled(true);
disabled();
m_ds.InDisabled(false);
while (isDisabled()) {
Timer.delay(0.01);
}
} else if (isAutonomous()) {
m_ds.InAutonomous(true);
autonomous();
m_ds.InAutonomous(false);
while (isAutonomous() && !isDisabled()) {
Timer.delay(0.01);
}
} else if (isTest()) {
LiveWindow.setEnabled(true);
m_ds.InTest(true);
test();
m_ds.InTest(false);
while (isTest() && isEnabled())
Timer.delay(0.01);
LiveWindow.setEnabled(false);
} else {
m_ds.InOperatorControl(true);
operatorControl();
m_ds.InOperatorControl(false);
while (isOperatorControl() && !isDisabled()) {
Timer.delay(0.01);
}
}
} /* while loop */
}
}
示例5: startMode
import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
@Override
public void startMode()
{
//
// Call TeleOp startMode.
//
super.startMode();
//
// Retrieve menu choice values.
//
test = testMenu.getCurrentChoiceObject();
boolean liveWindowEnabled = false;
switch (test)
{
case DRIVE_MOTORS_TEST:
motorIndex = 0;
break;
case X_TIMED_DRIVE:
timedDriveCommand = new CmdTimedDrive(robot, 0.0, robot.driveTime, robot.drivePower, 0.0, 0.0);
break;
case Y_TIMED_DRIVE:
timedDriveCommand = new CmdTimedDrive(robot, 0.0, robot.driveTime, 0.0, robot.drivePower, 0.0);
break;
case X_DISTANCE_DRIVE:
useTraceLog = true;
pidDriveCommand = new CmdPidDrive(
robot, 0.0, robot.driveDistance, 0.0, 0.0, robot.drivePowerLimit, true);
break;
case Y_DISTANCE_DRIVE:
useTraceLog = true;
pidDriveCommand = new CmdPidDrive(
robot, 0.0, 0.0, robot.driveDistance, 0.0, robot.drivePowerLimit, true);
break;
case TURN_DEGREES:
useTraceLog = true;
pidDriveCommand = new CmdPidDrive(
robot, 0.0, 0.0, 0.0, robot.turnDegrees, robot.drivePowerLimit, true);
break;
case VISION_DRIVE:
useTraceLog = true;
visionPidDriveCommand = new CmdVisionPidDrive(
robot, 0.0, robot.ultrasonicTarget, robot.visionTurnTarget, robot.drivePowerLimit);
break;
case SONAR_DRIVE:
useTraceLog = true;
sonarPidDriveCommand = new CmdSonarPidDrive(
robot, 0.0, robot.ultrasonicTarget, robot.drivePowerLimit);
break;
case VISION_TURN:
useTraceLog = true;
visionPidTurnCommand = new CmdVisionPidTurn(robot, 0.0, 0.0, robot.drivePowerLimit);
break;
case LIVE_WINDOW:
liveWindowEnabled = true;
break;
default:
break;
}
if (Robot.USE_TRACELOG && useTraceLog) robot.startTraceLog("Test");
LiveWindow.setEnabled(liveWindowEnabled);
sm.start(State.START);
}