Quote:
Originally Posted by Arbalest007
Hi guys, I just started programming for FRC this year in Java. However, I'm kinda confused over how to effectively use all the methods in the Watchdog() class like the feed method. Should I be using watchdog in the tele-operator section of the class to disable the robot in case I don't move it in a long time...or is it just for enabling safety on the robot before it is switched to autonomous or tele-operated mode? Also, I looked over the "Beginning with Java FRC" guide on Google, but I don't understand what the Timer class/methods are used for (i.e. why do I need to use Timer.delay(xx) within the teleoperated section of the class)?
|
In simplerobot template. you have to do your own looping. The timer.delay(xx) in teleop is to control the refresh rate. If you don't put in the timer.delay than you will be running the loop as fast as possible and tie up the cpu 100%. We learn this the hardway. In iterativerobot template the looping is done for you.
You want the teleop loop to keep pace with the driver station so each loop coincide with a new package that is send form the driver station. If you loop too fast there is no advantage except tying up your cpu and you will have problem with things like visual processing.. If you loop too slow than the robot will not react fast enough to things like joystick input.
The iterative robot/ driver station refresh at 50 hz ie every 20ms.
Watchdog is now deprecated.
Use motor safety feature instead.
http://wpilib.screenstepslive.com/s/...safety-feature