Go to Post And that's why we all need to consider reserving a "No! Bad robot!" button for the robocoach. :yikes: - vhcook [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 17-02-2010, 18:40
theprgramerdude theprgramerdude is offline
WPI Freshman
AKA: Alex
FRC #2503 (Warrior Robotics)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Brainerd, Minnesota
Posts: 347
theprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud of
Watchdog programming error

Hello everyone. I'm from team 2503 in Brainerd, Minnesota. Being the only student on the team with prior programming experience, it was up to me to design our program code this year. I am using Java this year, as it's simpler in terms of references (I originally learned C# as my first real computer language). However, I keep encountering a "watchdog not fed error on the console every time I go to run the code. This has still occurred after the 2.1/1.1 Labview/DS updates. I cannot for the life of me figure out the reason for this. The default code works fine, yet whatever I build myself does not

Some of the coding examples Ive tried are as follows:

I've added this section into the default code's teleopPeriodic method just to test whether I was doing something wrong with my programming. It works perfectly.
if (m_rightStick.getTrigger())
{
m_robotDrive.arcadeDrive(1.0, 0.0);
}

If I add this following line, however, the motor runs for about a tenth of a second, then a watchdog error trips and everything shuts down. I did modify the original RobotDrive to work on only ports 1 and 2, as we have only two drive motors. This let everything still work fine. These lines were added simply to test theories, and I know its very ugly in practice).
if (m_rightStick.getTop(Hand.kLeft))
{
RobotDrive pulley = new RobotDrive(3,4);
stuper.arcadeDrive(1.0, 0.0);

}


The last code segment is a full iterative robot template I've been using, and also trips the watchdog for unknown reasons. Any help will be much appreciated. Thanks. (note: I've omitted the import commands to save space).

public class RobotTemplate extends IterativeRobot {
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/

Jaguar right_drive_jaguar;
Jaguar left_drive_jaguar;
Jaguar pulley_motor;
Joystick loneRanger;
Watchdog idiot;
Compressor airthing;
Solenoid springLatcheron;
Solenoid springLatcherback;
Solenoid superKicker;
boolean on_off_kicker;
AxisCamera supercamerathing;

double x_value;
double y_value;
double leftdriver;
double rightdriver;


public void RobotTemplate() {
//create all objects
this.right_drive_jaguar = new Jaguar(1);
this.left_drive_jaguar = new Jaguar(2);
this.pulley_motor = new Jaguar(3);

this.loneRanger = new Joystick(1);
this.airthing = new Compressor(1,1);

this.on_off_kicker = true;

this.superKicker = new Solenoid(1);
this.springLatcheron = new Solenoid(2);
this.springLatcherback = new Solenoid(3);

//this.idiot = Watchdog.getInstance();
Watchdog.getInstance().feed();
//set all values

right_drive_jaguar.set(0);
left_drive_jaguar.set(0);
pulley_motor.set(0);

superKicker.set(false);
springLatcherback.set(true);
springLatcheron.set(true);

airthing.start();




//this.supercamerathing = AxisCamera.getInstance();








}


public void robotInit() {

}

public void disabledPeriodic() {
//idiot.feed();
Watchdog.getInstance().feed();
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
//idiot.feed();
right_drive_jaguar.set(.2);
left_drive_jaguar.set(.2);
Watchdog.getInstance().feed();
}

/**
* This function is called periodically during operator control
*/

public void teleopInit() {
right_drive_jaguar.set(0);
left_drive_jaguar.set(0);

}


public void teleopPeriodic() {
//idiot.feed();
Watchdog.getInstance().feed();
this.x_value = loneRanger.getX();
this.y_value = loneRanger.getY();
right_drive_jaguar.set(x_value);
left_drive_jaguar.set(y_value);
if (loneRanger.getTrigger(Hand.kLeft))
{
pulley_motor.set(.99);
}
else
{
pulley_motor.set(0);
}
}

}
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2010, 01:56
Ziggy's Avatar
Ziggy Ziggy is offline
Registered User
FRC #1372
 
Join Date: Feb 2010
Rookie Year: 2006
Location: San Diego
Posts: 1
Ziggy is an unknown quantity at this point
Send a message via AIM to Ziggy
Re: Watchdog programming error

I'm also using the iterative style for my robot and cannot figure out why the watchdog is still hungry... it's so annoying >.>
Reply With Quote
  #3   Spotlight this post!  
Unread 18-02-2010, 02:42
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: Watchdog programming error

Code:
public void teleopInit() {
right_drive_jaguar.set(0);
left_drive_jaguar.set(0);
Watchdog.getInstance().feed();
}
try that it should work when they say feed the Watchdog They MEAN FEED THE WATCH DOG.
Reply With Quote
  #4   Spotlight this post!  
Unread 18-02-2010, 16:28
theprgramerdude theprgramerdude is offline
WPI Freshman
AKA: Alex
FRC #2503 (Warrior Robotics)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Brainerd, Minnesota
Posts: 347
theprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud of
Re: Watchdog programming error

Thanks for the support. I tried the code as you posted it, but no dice. I did see an initial watchdog error, but then it ran with the statement teleop enabled for all of .1 seconds. After that, it showed the same watchdog not fed error, and I had to restart the robot to get any control again. However, I was running developer at the time with the driver station application as a popup, and Netbeans recorded the following output when the error occurred:
[cRIO] Default RobotIterativeBase:isabledInit() method running
[cRIO] Disabled_Init() completed
[cRIO] java.lang.NullPointerException
[cRIO] at java.lang.Throwable.<init>(Throwable.java:88)
[cRIO] at java.lang.Exception.<init>(Exception.java:44)
[cRIO] at java.lang.RuntimeException.<init>(RuntimeException .java:48)
[cRIO] at java.lang.NullPointerException.<init>(NullPointerE xception.java:54)
[cRIO] at com.sun.squawk.VM.nullPointerException(VM.java:391 )
[cRIO] at edu.wpi.first.wpilibj.templates.RobotTemplate.tele opInit(RobotTemplate.java:119)
[cRIO] at edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:171)
[cRIO] at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase .java:132)
[cRIO] at javax.microedition.midlet.MIDletTunnelImpl.callSta rtApp(MIDletTunnelImpl.java:60)
[cRIO] at com.sun.squawk.imp.MIDletMainWrapper.main(MIDletMa inWrapper.java:110)
[cRIO] at com.sun.squawk.Klass.main(Klass.java:2997)
[cRIO] at com.sun.squawk.Isolate.run(Isolate.java:1554)
[cRIO] at java.lang.Thread.run(Thread.java:231)
[cRIO] at com.sun.squawk.VMThread.callRun(VMThread.java:1499 )
[cRIO] at com.sun.squawk.VM.callRun(VM.java:305)
Reply With Quote
  #5   Spotlight this post!  
Unread 18-02-2010, 18:32
nikRbokRz nikRbokRz is offline
Registered User
FRC #1683
 
Join Date: Jan 2010
Location: Atlanta, GA
Posts: 14
nikRbokRz is an unknown quantity at this point
Re: Watchdog programming error

My team has been using "getWatchdog().feed();" in RobotTemplate, which for some reason seems to work. See if that works - I'm not exactly sure where "getWatchdog()" is in the source, but it seems to get the job done.

Hope this works... up until now, we actually had done "getWatchdog().setEnable(false)" but we figured using a Watchdog would be good practice
Reply With Quote
  #6   Spotlight this post!  
Unread 18-02-2010, 21:31
theprgramerdude theprgramerdude is offline
WPI Freshman
AKA: Alex
FRC #2503 (Warrior Robotics)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Brainerd, Minnesota
Posts: 347
theprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud of
Re: Watchdog programming error

Well, after a bit of testing today, I've narrowed down the problem. It appears that the watchdog itself does not cause an error; in fact, I believe it's simply acting the way it's designed to. It's timing out after there's a call error somewhere when switching to either autonomous or teleoperated mode. One of the methods or calls might be causing some error, as evidenced by the Netbeans output error. It'll take a little while longer to isolate the exact cause of this. Simply telling the Teleop periodic default to feed the watchdog only does not fix the issue in my original code, yet deleting/commenting out my reference variables and the variables in the constructor do fix the issue when switching to Teleop.
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
"watchdog not fed" error Lumit NI LabVIEW 8 04-02-2010 18:45
Button Programming Error? pyr0b0y NI LabVIEW 5 06-04-2009 17:18
Programming Error chinckley Programming 24 25-02-2009 20:29
CMU / RC / programming error N7UJJ Programming 3 18-02-2005 17:05
programming error agenova Programming 1 20-02-2002 13:00


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

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