View Single Post
  #1   Spotlight this post!  
Unread 02-17-2010, 10:47 PM
1195mentor 1195mentor is offline
Registered User
FRC #1195
 
Join Date: Jan 2010
Location: Bowie, MD
Posts: 4
1195mentor is an unknown quantity at this point
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 (c) 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 (c) 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!
Reply With Quote