|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
Watchdog Not Fed
Ok, so we're basically recoding our bot from last year
For some reason, our watchdog is not being fed Here is the java code: Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.camera.*;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.PWM;
public class robot10 extends IterativeRobot {
Joystick joystick=new Joystick(1);
DriverStation driverstation=DriverStation.getInstance();
AxisCamera camera;
RobotDrive mecanumWheels= new RobotDrive(1,2,3,4);
Solenoid extend1=new Solenoid(1);
Solenoid retract1=new Solenoid(2);
Solenoid extend2=new Solenoid(3);
Solenoid retract2=new Solenoid(4);
int b=0;
Relay compressor=new Relay(4,1);
PWM vacuum=new PWM(5);
PWM camServo=new PWM(6);
Watchdog watchdog=Watchdog.getInstance();
public void robotInit() {
compressor.set(Relay.Value.kOn);
camera=AxisCamera.getInstance();
watchdog.setEnabled(true);
watchdog.feed();
}
public void autonomousPeriodic() {
watchdog.setEnabled(true);
if(b==0){
watchdog.setEnabled(false);
watchdog.kill();
autoBot();
b++;
}
watchdog.feed();
}
public void teleopPeriodic() {
mecanumWheels.holonomicDrive(joystick.getMagnitude(), joystick.getDirectionDegrees(), joystick.getTwist());
if(joystick.getRawButton(1))
{
retract1.set(false);
retract2.set(false);
extend1.set(true);
extend2.set(true);
}else{
extend1.set(false);
extend2.set(false);
retract1.set(true);
retract2.set(true);
}
camServo.setPosition(joystick.getThrottle());
if(joystick.getRawButton(2))
vacuum.setRaw(255);
else
vacuum.setRaw(0);
watchdog.feed();
}
public void autoBot(){
Timer.delay(5);
mecanumWheels.arcadeDrive(255, 0);
Timer.delay(2);
extend1.set(true);
extend2.set(true);
Timer.delay(1);
extend1.set(false);
extend2.set(false);
retract1.set(true);
retract2.set(true);
Timer.delay(2);
retract1.set(false);
retract2.set(false);
extend1.set(true);
extend2.set(true);
Timer.delay(1);
extend1.set(false);
extend2.set(false);
retract1.set(true);
retract2.set(true);
Timer.delay(2);
retract1.set(false);
retract2.set(false);
extend1.set(true);
extend2.set(true);
Timer.delay(1);
extend1.set(false);
extend2.set(false);
retract1.set(true);
retract2.set(true);
Timer.delay(1);
retract1.set(false);
retract2.set(false);
watchdog.feed();
}
public void disabledInt(){
compressor.set(Relay.Value.kOff);
}
public void disabledPeriodic(){
watchdog.feed();
}
}
|
|
#2
|
||||
|
||||
|
Re: Watchdog Not Fed
Disable your watchdog. Don't use it. Don't implement it. The watchdog is not the way you should keep your robot safe.
|
|
#3
|
||||
|
||||
|
Re: Watchdog Not Fed
Burn watchdog. It has been the bane of my starting year as a programmer. In more cases than not, it has caused more issues than it protected us from. at times, it has somehow made the robot go full speed one direction, before disabling itself while sitting on the opposite alliance's goal.
if you are dead set on using watch dog, however, you need to feed it every so often. If you have any internal loops inside teleop periodic, (which is a bad idea to begin with) you should include a feed in them. additionally, if you have any delay, you need to disable watchdog prior to it. Delay basically stops the system from proceeding, and thus the watchdog thread is not fed for what it interpret as an inordinate amount of time. EDIT: which it does appear you are doing. speaking right out of my hat, java may find it problematic that you're trying to feed a dead, disabled watchdog, since it tries to feed it after killing it in auto-periodic. When exactly does the watchdog complain? Last edited by techkid86 : 25-01-2016 at 13:15. |
|
#4
|
|||||
|
|||||
|
Re: Watchdog Not Fed
This thread is from 2010. The WPILib is completely different now.
|
|
#5
|
||||
|
||||
|
Re: Watchdog Not Fed
Thats rather funny. I didn't even notice the date
![]() |
|
#6
|
|||||
|
|||||
|
Re: Watchdog Not Fed
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Watchdog not fed | brianelite | C/C++ | 12 | 14-03-2010 14:43 |
| Watchdog Not Fed! | masoug | C/C++ | 5 | 24-02-2010 19:59 |
| Autonomous Independent Code Issue Watchdog not fed | pilum40 | FRC Control System | 0 | 11-02-2010 12:00 |
| Watchdog Not Fed but, All Systems Are Go. | DHSrobotics | Java | 4 | 24-01-2010 22:01 |
| Watchdog not fed | ahudson | Programming | 1 | 22-01-2010 11:26 |