当前位置: 首页>>代码示例>>Java>>正文


Java Watchdog类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.Watchdog的典型用法代码示例。如果您正苦于以下问题:Java Watchdog类的具体用法?Java Watchdog怎么用?Java Watchdog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Watchdog类属于edu.wpi.first.wpilibj包,在下文中一共展示了Watchdog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: autonomousPeriodic

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public void autonomousPeriodic() {
	// feed the user watchdog at every period when in autonomous
	Watchdog.getInstance().feed();

	m_autoPeriodicLoops++;

	// generate KITT-style LED display on the solenoids
	SolenoidLEDsKITT( m_autoPeriodicLoops );

	/* the below code (if uncommented) would drive the robot forward at half speed
	 * for two seconds.  This code is provided as an example of how to drive the
	 * robot in autonomous mode, but is not enabled in the default code in order
	 * to prevent an unsuspecting team from having their robot drive autonomously!
	 */
	/* below code commented out for safety
	if (m_autoPeriodicLoops == 1) {
		// When on the first periodic loop in autonomous mode, start driving forwards at half speed
		m_robotDrive->Drive(0.5, 0.0);			// drive forwards at half speed
	}
	if (m_autoPeriodicLoops == (2 * GetLoopsPerSec())) {
		// After 2 seconds, stop the robot
		m_robotDrive->Drive(0.0, 0.0);			// stop robot
	}
	*/
}
 
开发者ID:rich3571,项目名称:testGIT,代码行数:26,代码来源:DefaultRobot.java

示例2: robotInit

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public void robotInit() {
    //Com.ps = new Communication.PISocket(true);
    
    /*
    try{
        Com.ps.init(true);
        Com.ps.GetData();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    */
    wd = Watchdog.getInstance();
    wd.setExpiration(0.5);
    SI.init();
    IM.init();
    MC.init();
    wd.feed();
}
 
开发者ID:amesrobotics,项目名称:2013robot,代码行数:19,代码来源:RobotProject.java

示例3: autonomousPeriodic

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
/**
 * This function is called periodically during autonomous
 */
public void autonomousPeriodic() {
    try {
        for (int i = 0; i < components.length; ++i)
            components[i].tickAuto();
    } catch (Exception e) {
        e.printStackTrace();
        Watchdog.getInstance().kill();
    }
}
 
开发者ID:team178,项目名称:CaptainFalcon,代码行数:13,代码来源:Robot.java

示例4: teleopPeriodic

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
/**
 * This function is called periodically during operator control
 */
public void teleopPeriodic() {
    try {
        for (int i = 0; i < components.length; ++i)
            components[i].tickTeleop();
    } catch (Exception e) {
        e.printStackTrace();
        Watchdog.getInstance().kill();
    }
}
 
开发者ID:team178,项目名称:CaptainFalcon,代码行数:13,代码来源:Robot.java

示例5: disabledPeriodic

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public void disabledPeriodic()  {
	// feed the user watchdog at every period when disabled
	Watchdog.getInstance().feed();

	// increment the number of disabled periodic loops completed
	m_disabledPeriodicLoops++;

	// while disabled, printout the duration of current disabled mode in seconds
	if ((Timer.getUsClock() / 1000000.0) > printSec) {
		System.out.println("Disabled seconds: " + (printSec - startSec));
		printSec++;
	}
}
 
开发者ID:rich3571,项目名称:testGIT,代码行数:14,代码来源:DefaultRobot.java

示例6: autonomousPeriodic

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
/**
 * This function is called periodically during autonomous
 */
public void autonomousPeriodic() {
    WsInputManager.getInstance().updateOiDataAutonomous();
    WsInputManager.getInstance().updateSensorData();
    WsAutonomousManager.getInstance().update();
    WsSubsystemContainer.getInstance().update();
    WsOutputManager.getInstance().update();
    Watchdog.getInstance().feed();
}
 
开发者ID:wildstang111,项目名称:2013_drivebase_proto,代码行数:12,代码来源:RobotTemplate.java

示例7: teleopPeriodic

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public void teleopPeriodic() {
//        periodTimer.endTimingSection();
//        periodTimer.startTimingSection();
//        durationTimer.startTimingSection();
        WsInputManager.getInstance().updateOiData();
        WsInputManager.getInstance().updateSensorData();
        WsSubsystemContainer.getInstance().update();
        WsOutputManager.getInstance().update();
        Watchdog.getInstance().feed();
//        durationTimer.endTimingSection();
    }
 
开发者ID:wildstang111,项目名称:2013_drivebase_proto,代码行数:12,代码来源:RobotTemplate.java

示例8: robotInit

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
/**
 * This function is run when the robot is first started up and should be used for any initialization code.
 */
public void robotInit() {
    watchdog = Watchdog.getInstance();
    watchdog.setEnabled(false);
    CommandBase.init(); //initializes commands
    mecDrive = new DriveCommand();
    info = new FrontSensorToDash();
    auto = new Autonomous();
    //RobotMap.camera = AxisCamera.getInstance();
}
 
开发者ID:owatonnarobotics,项目名称:2014RobotCode,代码行数:13,代码来源:Robot.java

示例9: FRC2014Java

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
FRC2014Java(){
    
    //Motor Controllers
    leftDrive = new Talon(TALON_PORT_L);
    rightDrive = new Talon(TALON_PORT_R);
    
    //Joystick
    xbox = new Joystick(1);
    
    //Winch
    winch = new Talon(2);
    
    //Intake
    intake = new Talon(8);
    
    //Cam
    cam = new Talon(3);
    
    //Catapult Limit Switch
    catapultLimit = new DigitalInput(1);
    
    //Cam Limit Switch
    camLimit = new DigitalInput(2);
    
    //Intake Limit Switch
    intakeLimit = new DigitalInput(3);
    
    //Cameras
    cameraFront = AxisCamera.getInstance("10.10.2.11");
    cameraBack = AxisCamera.getInstance("10.10.2.12");
    
    //Watchdog
    dog = Watchdog.getInstance();
}
 
开发者ID:CircuitRunners,项目名称:frc_2014_aerialassist,代码行数:35,代码来源:FRC2014Java.java

示例10: TitanRobot

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
/**
 * Constructs a TitanRobot object.
 */
public TitanRobot() {
    System.out.println("Creating TitanRobot instance for 2014.");
    componentRegistry = new ComponentRegistry();
    stateRegistry = new StateRegistry();
    autonomousRunner = new AutonomousRunner(this);
    teleOperatedRunner = new TeleOperatedRunner(this);
    testRunner = new TestRunner(this);
    setInstance();
    Watchdog.getInstance().setEnabled(WATCHDOG_ENABLE);
    System.out.println("TitanRobot ready for operation.");
}
 
开发者ID:TaylorRobotics,项目名称:TitanRobot2014,代码行数:15,代码来源:TitanRobot.java

示例11: run

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public void run() {
        /* Run in teleoperated loop as long as robot is enabled */
        while (robot.isOperatorControl() && robot.isEnabled()) {
            /* Handle operations */
            directionButtonHandler.run();
            speedButtonHandler.run();
            componentRegistry.getRobotDrive().drive(0.0, 0);
            tankDriveHandler.run();

            pickupButtonHandler.run();

            /* Handle shoulder operations - order of handlers is important */
            shoulderButtonHandler.run();
            shoulderManualPositionHandler.run();
            shoulderSeekPositionHandler.run();
            shoulderServoHandler.run();

            /* Handle shooting operations */
            hammerButtonHandler.run();
//            autoShootHandler.run();
            shootingHandler.run();

            /* Update indicator lights */
            shootingDistanceLightHandler.run();
            hammerLatchedLightHandler.run();

            /* Update Messages */
            boolean updateNeeded = armPositionMonitor.update();
            updateNeeded |= distanceMonitor.update();
            if (updateNeeded) {
                messageDisplay.update();
            }

            /* Feed watchdog to prevent shutdown and then wait */
            Watchdog.getInstance().feed();
            Timer.delay(TELEOPERATED_LOOP_DELAY);
        }
        componentRegistry.getRobotDrive().drive(0.0, 0);
    }
 
开发者ID:TaylorRobotics,项目名称:TitanRobot2014,代码行数:40,代码来源:TeleOperatedRunner.java

示例12: drive

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
private void drive(double pSpeed, int pTurn) {
    boolean reverseLeftMotor = (FRONT_LEFT_DRIVE_MOTOR_DIRECTION == REVERSE);
    boolean reverseRightMotor = (FRONT_RIGHT_DRIVE_MOTOR_DIRECTION == REVERSE);

    /* Drive after adjusting for drive direction */
    robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, !reverseLeftMotor);
    robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, !reverseRightMotor);

    robotDrive.drive(pSpeed, pTurn);
    Watchdog.getInstance().feed();
}
 
开发者ID:TaylorRobotics,项目名称:TitanRobot2014,代码行数:12,代码来源:AutonomousRunner.java

示例13: robotInit

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotInit() {
    // instantiate the command used for the autonomous period

    // Initialize all subsystems
    CommandBase.init();

    Watchdog.getInstance().setEnabled(true);
}
 
开发者ID:Arcterus,项目名称:RobotCode-2015,代码行数:13,代码来源:Robot.java

示例14: teleopPeriodic

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public void teleopPeriodic(){
    Scheduler.getInstance().run(); //update commands
    SmartDashboard.putNumber("Speed", CommandBase.Drive.getSpeed());
    SmartDashboard.putNumber("GyroAngle", CommandBase.Drive.getAngle());
    //System.out.println("Left Speed: " + CommandBase.Drive.getLeftSpeed());
    //System.out.println("Right Speed: " + CommandBase.Drive.getRightSpeed());
    CommandBase.OI.updateGripSwitch();
    Watchdog.getInstance().feed(); //very hungry
}
 
开发者ID:Team766,项目名称:Valkyrie,代码行数:10,代码来源:Valkyrie.java

示例15: WatchdogWrapper

import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public WatchdogWrapper(Watchdog w) {
    this.w = w;
}
 
开发者ID:team178,项目名称:CaptainFalcon,代码行数:4,代码来源:WatchdogWrapper.java


注:本文中的edu.wpi.first.wpilibj.Watchdog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。