Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Java wait Function (http://www.chiefdelphi.com/forums/showthread.php?t=127327)

Domenic Rodriguez 04-03-2014 11:50

Re: Java wait Function
 
The MotorSafetyHelper is disabled by default for the Victor, Jaguar, and Talon classes. It is enabled by default for RobotDrive with a 100 ms timeout.

From RobotDrive.java:
Code:

...
public static final double kDefaultExpirationTime = 0.1;
...
private void setupMotorSafety() {
    m_safetyHelper = new MotorSafetyHelper(this);
    m_safetyHelper.setExpiration(kDefaultExpirationTime);
    m_safetyHelper.setSafetyEnabled(true);
}


Greg McKaskle 10-03-2014 21:07

Re: Java wait Function
 
That matches what I'd hoped for. Great.

Greg McKaskle

NotInControl 14-03-2014 15:45

Re: Java wait Function
 
Quote:

Originally Posted by cgmv123 (Post 1351209)
Timer.delay() is supposed to leave outputs set where they are as well, but I've had more success using Timer.getFPGATimestamp() in conjunction with a loop.

If I remember correctly, Timer.delay() is a wrapper and simply calls Thread.sleep().

This causes the calling thread to sleep, and thus will cause your robot to hang unless called from a separate thread.

Use time stamps as mentioned.

System.getCurrentTimeMillis, or the FPGA timer, or anything else in a loop,

or spawn a separate thread and call thread.sleep() in the new thread.

But do not call Thread.sleep or Timer.Delay in the same thread as your TeleOp/Auto periodic functions.

Hope this helps,
Kevin


All times are GMT -5. The time now is 12:16.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi