Desperate for watchdog help

Hello,
Last year we programmed in LabView and though we would try Java this year. We are in Maryland and we have lost 2 weeks due to snowstorms and are basically back at square one with programming. Our teleoperated code keeps shutting down because we aren’t feeding the watchdog though we have tried to use the examples in the Getting Started guide. I would greatly appreciate any assistance you can provide

Here is the code

/----------------------------------------------------------------------------/
/* Copyright © FIRST 2008. All Rights Reserved. /
/
Open Source Software - may be modified and shared by FRC teams. The code /
/
must be accompanied by the FIRST BSD license file in the root directory of /
/
the project. /
/
----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Joystick;
/**

  • The VM is configured to automatically run this class, and to call the

  • functions corresponding to each mode, as described in the SimpleRobot

  • documentation. If you change the name of this class or the package after

  • creating this project, you must also update the manifest file in the resource

  • directory.
    */
    public class Wednesday extends SimpleRobot
    {
    private RobotDrive drivetrain;
    private Joystick leftStick;
    private Joystick rightStick;

    public Wednesday()
    {
    drivetrain = new RobotDrive(1, 2, 3, 4, 0.5); //create RobotDrive
    leftStick = new Joystick(1);
    rightStick = new Joystick(2);
    }

    public void autonomous() {

     getWatchdog().setEnabled(false);
    // rtimer.start();
    while (true && isAutonomous() && isEnabled()) {
    
     for (int i = 0; i < 4; i++)
     {
      drivetrain.drive(0.5, 0.0); // drive 50% fwd 0% turn
      Timer.delay(2.0); // wait 2 seconds
      drivetrain.drive(0.5, 0.75); // drive 0% fwd, 75% turn
      Timer.delay(2.0); // wait 2 seconds
     }
     drivetrain.drive(0.0, 0.0); // drive 0% forward, 0% turn
    }
    

    }
    /**

    • This function is called once each time the robot enters operator control.
      */
      public void OperatorControl()
      {
      getWatchdog().setEnabled(true);
      while (true && isOperatorControl() && isEnabled()) // loop until change
      {getWatchdog().feed();

      // Watchdog.getInstance().feed();
      

      drivetrain.tankDrive(leftStick, rightStick); // drive with joysticks
      Timer.delay(0.005);
      }
      }

    }

/----------------------------------------------------------------------------/
/* Copyright © FIRST 2008. All Rights Reserved. /
/
Open Source Software - may be modified and shared by FRC teams. The code /
/
must be accompanied by the FIRST BSD license file in the root directory of /
/
the project. /
/
----------------------------------------------------------------------------*/

Thank you very much!

The things you could possibly do to fix problem:
1.add a robot main
2.specifly the slot of the module that connencts the CRIO to the sidecar
3.Test one part of your code at a time to see what is causing the problem

This is what our team did, hope it helps you.
Sorry if it doesn’t

Hi 1195,

We had watchdog woes until I adopted a new strategy.

(BTW, you don’t need a robotMain() with SimpleRobot. In fact, don’t include one unless you read the source for SimpleRobot and RobotBase.)

  1. Feed the dog often, after every few lines–and after every line that does could pause (because it’s a delay, or because it does i/o, or does a lot of math).

  2. If you still have problems, comment out everything, then slowly comment lines back in until you find the one that makes the watchdog die. Tedious, but it works, and it teaches you a lot about the watchdog.

  3. You can ease the pain of number 2 by increasing the watchdog time a bit.

Hats off to you for keeping the watchdog enabled! I know many teams just disable it, which isn’t good practice.

**I want to issue a warning to any teams experiencing intermittent watchdog timer issues… **while you may see minor glitches in motion or relay actions while practicing with your router wireless connection, when you operate with the FIRST Field setup computer system (ie. when your at a competition) when you experience a watchdog error, the field system will shut down your communication for the rest of the match. We experienced this in multiple rounds at the Suffield Scrimmage today which uses the official field setup control.

So, If you are experiencing watchdog errors** you MUST resolve this before competition**, or you will have a dead robot on the field following your first watchdog error.

We were finally able to elimate our issue (we saw 1-4 watchdog errors per minute) by removing all unused code (LabView - we weren’t using the camera, gyro, and some other solenoid controls that we dont have installed on the bot yet). We will be adding in some of our other code step by step later to see what might be causing the errors we saw. BTW, our errors were System Watchdog errors (I disabled the User watchdog for a period, but still got system type errors).

Merle Yoder
GRUNTS Team 3146
Granby, CT

ok so how do we disable user watchdog then.