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


Java Timer.getFPGATimestamp方法代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.Timer.getFPGATimestamp方法的典型用法代碼示例。如果您正苦於以下問題:Java Timer.getFPGATimestamp方法的具體用法?Java Timer.getFPGATimestamp怎麽用?Java Timer.getFPGATimestamp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.wpi.first.wpilibj.Timer的用法示例。


在下文中一共展示了Timer.getFPGATimestamp方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
public void run()
{
	double lastWriteTime = Timer.getFPGATimestamp();
	while (true)
	{
		try
		{
			String msg = logMessages.take();
			writer.write(msg);
			if (Timer.getFPGATimestamp() >= lastWriteTime + WRITE_TIME)
			{
				writer.flush();
				lastWriteTime = Timer.getFPGATimestamp();
			}
		}
		catch (InterruptedException | IOException e)
		{
			((Throwable) e).printStackTrace();
		}
	}
}
 
開發者ID:BytingBulldogs3539,項目名稱:BBLIB,代碼行數:22,代碼來源:BulldogLogger.java

示例2: periodicStatusUpdate

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
public void periodicStatusUpdate() {
    double currentTime = Timer.getFPGATimestamp(); // seconds
    // only update the smart dashboard twice per second to prevent
    // network congestion.
    if(currentTime - this.lastTime > .5) {
    	updateIMUStatus();
    	updateLauncherStatus();
    	updateDrivetrainStatus();
    	this.lastTime = currentTime;
    	if (ModuleManager.PORTCULLIS_MODULE_ON)
    	    SmartDashboard.putBoolean(" Portcullis Upper Right Limit Switch", RobotMap.portcullisRightMotor.isFwdLimitSwitchClosed());
            SmartDashboard.putBoolean(" Portcullis Upper Left Limit Switch", RobotMap.portcullisLeftMotor.isFwdLimitSwitchClosed());
            SmartDashboard.putBoolean(" Portcullis Lower Right Limit Switch", RobotMap.portcullisRightMotor.isRevLimitSwitchClosed());
            SmartDashboard.putBoolean(" Portcullis Lower Left Limit Switch", RobotMap.portcullisLeftMotor.isRevLimitSwitchClosed());
    }
}
 
開發者ID:Spartronics4915,項目名稱:2016-Stronghold,代碼行數:17,代碼來源:Robot.java

示例3: execute

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
protected void execute() {
	double runTime = Timer.getFPGATimestamp() - startTime;
	
	
	if(runTime < 2) {
		RobotMap.driveTrainLeftFront.set(0.5);
		RobotMap.driveTrainRightFront.set(0.0);
		RobotMap.driveTrainLeftRear.set(0.0);
		RobotMap.driveTrainRightRear.set(0.0);
	} else if(runTime < 4) {
		RobotMap.driveTrainLeftFront.set(0.0);
		RobotMap.driveTrainRightFront.set(0.5);
		RobotMap.driveTrainLeftRear.set(0.0);
		RobotMap.driveTrainRightRear.set(0.0);
	} else if(runTime < 6) {
		RobotMap.driveTrainLeftFront.set(0.0);
		RobotMap.driveTrainRightFront.set(0.0);
		RobotMap.driveTrainLeftRear.set(0.5);
		RobotMap.driveTrainRightRear.set(0.0);
	} else if(runTime < 8) {
		RobotMap.driveTrainLeftFront.set(0.0);
		RobotMap.driveTrainRightFront.set(0.0);
		RobotMap.driveTrainLeftRear.set(0.0);
		RobotMap.driveTrainRightRear.set(0.5);
	} else {
		RobotMap.driveTrainLeftFront.set(0.0);
		RobotMap.driveTrainRightFront.set(0.0);
		RobotMap.driveTrainLeftRear.set(0.0);
		RobotMap.driveTrainRightRear.set(0.0);
	} 
	
}
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:33,代碼來源:MotorPositionCheck.java

示例4: initialize

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
protected void initialize() {

setInitEncoderVal(DriveEncoders.getAbsoluteValue());
SmartDashboard.putString("Auton Debugging", "DriveForwardInit");
System.out.println("DriveFowardInit");
startTime = Timer.getFPGATimestamp();
}
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:8,代碼來源:DriveCorrected.java

示例5: execute

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
protected void execute() {
	double runTime = Timer.getFPGATimestamp() - startTime;
	
	if(runTime < 2) {
		WheelMotors.lFrontDrive.set(0.5);
		WheelMotors.rFrontDrive.set(0.0);
		WheelMotors.lRearDrive.set(0.0);
		WheelMotors.rRearDrive.set(0.0);
	} else if(runTime < 4) {
		WheelMotors.lFrontDrive.set(0.0);
		WheelMotors.rFrontDrive.set(0.5);
		WheelMotors.lRearDrive.set(0.0);
		WheelMotors.rRearDrive.set(0.0);
	} else if(runTime < 6) {
		WheelMotors.lFrontDrive.set(0.0);
		WheelMotors.rFrontDrive.set(0.0);
		WheelMotors.lRearDrive.set(0.5);
		WheelMotors.rRearDrive.set(0.0);
	} else if(runTime < 8) {
		WheelMotors.lFrontDrive.set(0.0);
		WheelMotors.rFrontDrive.set(0.0);
		WheelMotors.lRearDrive.set(0.0);
		WheelMotors.rRearDrive.set(0.5);
	} else {
		WheelMotors.lFrontDrive.set(0.0);
		WheelMotors.rFrontDrive.set(0.0);
		WheelMotors.lRearDrive.set(0.0);
		WheelMotors.rRearDrive.set(0.0);
	} 
}
 
開發者ID:FRC2832,項目名稱:Practice_Robot_Code,代碼行數:31,代碼來源:MotorPositionCheck.java

示例6: isFinished

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
protected boolean isFinished() {
	double runTime = Timer.getFPGATimestamp() - startTime;
	if(runTime < 8) {
		return false;
	}
	else {
		return true;
	}
}
 
開發者ID:FRC2832,項目名稱:Practice_Robot_Code,代碼行數:10,代碼來源:MotorPositionCheck.java

示例7: TimedOpenLoopController

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
public TimedOpenLoopController(double start_power, double time_full_on, double end_power, double time_to_decel) {
    m_t0 = Timer.getFPGATimestamp();
    m_t1 = m_t0 + time_full_on;
    m_t2 = m_t1 + time_to_decel;
    m_start_power = start_power;
    m_end_power = end_power;
}
 
開發者ID:team8,項目名稱:FRC-2017-Public,代碼行數:8,代碼來源:TimedOpenLoopController.java

示例8: isFinished

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
protected boolean isFinished() {
 	if (Timer.getFPGATimestamp() - startTime > timeout) {
return true;
 	}
 	else {
 		return false;
 	}
 }
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:9,代碼來源:DriveForwardNoSensor.java

示例9: runCrashTracked

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
@Override
public void runCrashTracked() {
	synchronized (taskRunningLock_) {
		if (running_) {
			double now = Timer.getFPGATimestamp();
			for (Loop loop : loops_) {
				loop.update();
			}
			dt_ = now - timestamp_;
			timestamp_ = now;
		}
	}
}
 
開發者ID:team8,項目名稱:FRC-2017-Public,代碼行數:14,代碼來源:Looper.java

示例10: initialize

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
protected void initialize() {
  	RobotMap.driveTrainRightFront.setPosition(0);
  	RobotMap.driveTrainLeftFront.setPosition(0);
RobotMap.driveTrainLeftFront.setEncPosition(0);
RobotMap.driveTrainRightFront.setEncPosition(0);
  	startTime = Timer.getFPGATimestamp();
  	maxAccel = 0;
  	minAccel = 0;
  	//initRightEnc = DriveEncoders.getRawRightValue();
  	//initLeftEnc = DriveEncoders.getRawLeftValue();
  	//prevTime = System.currentTimeMillis();
  	//prevRightError = 0;
  	//prevLeftError = 0;
  	//SmartDashboard.putString("Auton Debugging", "DriveForwardInit");
  	}
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:16,代碼來源:DriveForwardBackup.java

示例11: reportJoystickUnpluggedWarning

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
/**
 * Reports errors related to unplugged joysticks Throttles the errors so that they don't overwhelm
 * the DS.
 */
private void reportJoystickUnpluggedWarning(String message)
{
    double currentTime = Timer.getFPGATimestamp();
    if(currentTime > m_nextMessageTime)
    {
        reportWarning(message, false);
        m_nextMessageTime = currentTime + JOYSTICK_UNPLUGGED_MESSAGE_INTERVAL;
    }
}
 
開發者ID:Team-2502,項目名稱:RobotCode2018,代碼行數:14,代碼來源:DriverStationF.java

示例12: pidWrite

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
@Override
public void pidWrite(double v) {
  double outputDifference = v - lastOutput;
  double currentTime = Timer.getFPGATimestamp();
  double timeDifference = currentTime - lastTimestamp;

  if (Math.abs(outputDifference) / timeDifference > maxRate) {
    v = lastOutput + Math.signum(outputDifference) * maxRate * timeDifference;
  }

  output.pidWrite(v);

  lastTimestamp = currentTime;
  lastOutput = v;
}
 
開發者ID:TeamMeanMachine,項目名稱:meanlib,代碼行數:16,代碼來源:RateLimitedPIDOutput.java

示例13: initialize

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
@Override
protected void initialize() {
  m_prevTime = Timer.getFPGATimestamp();
  if (backwards)
    m_playTime = m_animationLength;
  else
    m_playTime = 0.0;
}
 
開發者ID:TeamMeanMachine,項目名稱:meanlib,代碼行數:9,代碼來源:PlayAnimationCommand.java

示例14: HandleWaitForHotGoal

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
private void HandleWaitForHotGoal()
{
    if ((m_autonomousImageDetector.CurrentDetectionState() != AutonomousImageDetector.DETECTION_STATE_GOAL_UNLIT) ||
            ((m_autonomousImageDetector.CurrentDetectionState() == AutonomousImageDetector.DETECTION_STATE_GOAL_UNLIT) &&
             ((Timer.getFPGATimestamp() - m_autonomousStartTime) > 5.0)) 
       )
    {
        // When done move to next state
        m_currentStateIndex ++;
        SetCurrentState(m_nextStateArray[m_currentStateIndex]);
    }
}
 
開發者ID:Dinoyan,項目名稱:FRC-2014-robot-project,代碼行數:13,代碼來源:AutonomousModeHandler.java

示例15: HandleStateSlowRelease

import edu.wpi.first.wpilibj.Timer; //導入方法依賴的package包/類
private void HandleStateSlowRelease()
{
    double currentTime = Timer.getFPGATimestamp();
    
    // assume we should finish within 5  seconds
    if (currentTime - m_pullBackStartTime > 5)
    {
        m_isPulledBack = false;
        m_currentState = SHOOTER_CONTROL_STATE_WAIT;   
    }
}
 
開發者ID:Dinoyan,項目名稱:FRC-2014-robot-project,代碼行數:12,代碼來源:ShooterControl.java


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