Go to Post I've had parents tell me I'm a great role model for their daughters, because I was a female leader. It's a great feeling to hear something like that. - Liz Smith [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-01-2010, 15:54
Robopanda6 Robopanda6 is offline
Registered User
FRC #2477
 
Join Date: Jan 2009
Location: Waipahu,HI
Posts: 18
Robopanda6 is an unknown quantity at this point
Feeding the Watchdog

I am trying to run my teleoperated code and it builds successfully when i debug but when I run the program it says the watchdog is not fed. I followed how the default code fed the watchdog but it still didn't work. The I tried downloading the default code but it still says the watchdog is not fed. Does anyone know how to disable the watchdog or feed it?

The advice would be much appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2010, 16:12
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Feeding the Watchdog

Here's basically how the watchdog works. Except in autonomous mode the watchdog must be enabled. It then must be fed every x settings, x is determined with the SetExpiration(numSeconds) function (usually called in the constructor of your robot class). Failure to do so results in your robot being promptly disabled.

To enable the watchdog you can use the function (SetEnabled(true)) and to disable, SetEnabled(false). Following that you must feed it using Feed().

Here's a sample program in C++ (should be quite similar in Java).

Code:
#include "WPILib.h"

class Robot : public SimpleRobot {
	
	Robot(void) {
		GetWatchdog().SetExpiration(0.1); // Must feed watchdog every 100mS
	}
	
	void Autonomous(void) {
		GetWatchdog().SetEnabled(false);
		// Autonomous Code here
	}
	
	void OperatorControl(void) {
		GetWatchdog().SetEnabled(true);
		
		while (IsOperatorControl() && !IsDisabled()) {
			GetWatchdog.Feed();
			
			// Teleop code here
			
			Wait(0.05);
		}
		
	}
 	
}

START_ROBOT_CLASS(Robot);
Sometimes when your camera is booting up or you execute another function that takes a little time, the Dashboard will say the Watchdog is not fed as it hasn't got that far in the program.

According to http://first.wpi.edu/Images/CMS/Firs...va_for_FRC.pdf to equivalent Java functions are:

Code:
// Similar to C++, just note the case.
getWatchdog().setEnabled(true);
getWatchdog().setExpiration(0.1);
getWatchdog().feed();

Last edited by basicxman : 30-01-2010 at 16:18.
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2010, 17:51
Robopanda6 Robopanda6 is offline
Registered User
FRC #2477
 
Join Date: Jan 2009
Location: Waipahu,HI
Posts: 18
Robopanda6 is an unknown quantity at this point
Re: Feeding the Watchdog

Thank you for the advice but...
I've tried your way of setting up the feed but it doesn't work. I tried the way the PDF you sent me did it before your way of doing the watchdog feed but it still didn't work then either. Is there any way else anyone can suggest?
__________________
"They say the struggle only sweetens the success"...I guess that's why I stayed in Robotics.
Reply With Quote
  #4   Spotlight this post!  
Unread 31-01-2010, 13:16
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Feeding the Watchdog

The example basicxman gave is correct. If it isn't working for you you should look carefully at your code for these things:
any init (such as the camera mentioned) that might take longer than the expiration
are you feeding it within all loops that might run longer than the expiration
do you ever pend on input that may not come fast enough
Timer.delay calls that may total too much time

Examine every loop or method call to make sure. Put printlns in that display the time in potential problem areas, some things, like processing large images take a lot longer than you might think. Lots of printlns are expensive. DriverStationLCD prints take a while. etc.

If you post your code we could look for potential problem areas

Good luck!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: WAI: Packbot feeding salad to FIRST Mentor@ NURC Moheeb698 Extra Discussion 3 19-10-2009 01:52
Watchdog darty NI LabVIEW 8 16-02-2009 09:11
Watchdog Barchechath Programming 6 10-02-2007 20:05
Ball Feeding Tube Legality phrontist Rules/Strategy 4 13-02-2006 22:30
Goal feeding ball mechanism????? Rob Kelly Technical Discussion 2 03-02-2002 23:28


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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