本文整理汇总了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();
}
}
}
示例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());
}
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例8: isFinished
import edu.wpi.first.wpilibj.Timer; //导入方法依赖的package包/类
protected boolean isFinished() {
if (Timer.getFPGATimestamp() - startTime > timeout) {
return true;
}
else {
return false;
}
}
示例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;
}
}
}
示例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");
}
示例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;
}
}
示例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;
}
示例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;
}
示例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]);
}
}
示例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;
}
}