View Single Post
  #2   Spotlight this post!  
Unread 23-09-2014, 17:04
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Random Rookie Programmer Question About Timer and Watchdog

Quote:
Originally Posted by Arbalest007 View Post
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)?
You shouldn't have to touch the watchdog. I'm guessing you're seeing the watchdog not fed enough warning.

This is often the result of using Timer.delay in the wrong way.

When you call Timer.delay, it "pauses" the code for that amount of time. To the robot, it is as though you are telling it to close it's eyes and do something for that amount of time.

Your robot does however need to "blink", but I recommend trying out IterativeRobot, because the WPI code will handle that. Only if you're using SimpleRobot would I use Timer.delay at all. (One more piece of advice, a SimpleRobot is not necessarily the simplest to implement, the naming convention tricked me for quite some time)

Here is a previous post where I described how I approach time based tasks.

http://www.chiefdelphi.com/forums/sh...43#post1349743

You'll also notice that there was a post after mine, if you know why not, then you are well along your way....
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 23-09-2014 at 17:15.
Reply With Quote