当前位置: 首页>>代码示例>>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;未经允许,请勿转载。