本文整理汇总了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
}
*/
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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++;
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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.");
}
示例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);
}
示例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();
}
示例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);
}
示例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
}
示例15: WatchdogWrapper
import edu.wpi.first.wpilibj.Watchdog; //导入依赖的package包/类
public WatchdogWrapper(Watchdog w) {
this.w = w;
}