Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Is getWatchdog() required in RobotTemplate.java? (http://www.chiefdelphi.com/forums/showthread.php?t=125509)

Crzycoco 30-01-2014 18:14

Is getWatchdog() required in RobotTemplate.java?
 
I was wondering if we HAVE to have getWatchdog() in our code or is it optional. I know it prevents the robot from malfunction but I don't know if it's required. Thanks guys, FIRST ::safety:: rules!

jtrv 04-02-2014 19:18

Re: Is getWatchdog() required in RobotTemplate.java?
 
Would also like to know. Thanks to anyone who has the info.

RufflesRidge 04-02-2014 19:21

Re: Is getWatchdog() required in RobotTemplate.java?
 
No. If you do not know what the watchdog is or how to use it properly I recommend you avoid it.

MatthewC529 10-03-2014 01:30

Re: Is getWatchdog() required in RobotTemplate.java?
 
I personally use Watchdog.getInstance() in my code.

Watchdog scruffy = Watchdog.getInstance(); //for instance

getInstance() is a common method provided in Singleton classes or classes that are mean to NOT be instantiated. A good example is the Math class in Java SE 7 (Does not have getInstance()... meaning "REALLY do not get this instance"). Another example is the Java SE 7 Toolkit class which some games use for getting the screen width of your computer. It has a method called Toolkit.getDefaultToolkit() which might as well be Toolkit.getInstance().

That method ensures only ONE instance of the class EVER exists. You wouldnt want two logging classes posting to the console (in most cases) so you make it a singleton with getInstance() capability. Only one Watchdog will EVER exist. That is all that means.

You can freely use getInstance to have your own reference to the Watchdog object just so you are familiar. Like mine is named Scruffy.


All times are GMT -5. The time now is 22:31.

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