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


Java LiveWindow.setEnabled方法代碼示例

本文整理匯總了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);
    }
 
開發者ID:nerdherd,項目名稱:Stronghold2016,代碼行數:69,代碼來源:Robot.java

示例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 */
  }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:57,代碼來源:SampleRobot.java

示例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();
  }
}
 
開發者ID:ArcticWarriors,項目名稱:snobot-2017,代碼行數:79,代碼來源:IterativeRobot.java

示例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 */
  }
}
 
開發者ID:trc492,項目名稱:Frc2016FirstStronghold,代碼行數:56,代碼來源:SampleRobot.java

示例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);
}
 
開發者ID:trc492,項目名稱:Frc2017FirstSteamWorks,代碼行數:77,代碼來源:FrcTest.java


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