|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need a Full "Watchdog for idiots" explanation | K Lenox | NI LabVIEW | 9 | 16-02-2010 14:10 |
| Desperate need of help | MrExploiter | Programming | 9 | 25-02-2008 22:38 |
| Desperate for help in camera tracking | itsme | Programming | 9 | 06-02-2007 15:55 |
| In desperate need of some help | archiver | 2000 | 0 | 23-06-2002 23:40 |
| desperate help | Andrew Dahl | General Forum | 0 | 21-11-2001 12:08 |