View Single Post
  #11   Spotlight this post!  
Unread 17-02-2013, 19:53
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,658
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Watchdog not being fed

I agree that you don't seem to be using the watchdog anywhere. While there's a Watchdog that's a member of the SimpleRobot class you derive from, the SimpleRobot constructor disables it by default. You have to actively enable it for it to do something. If you're really sure that's the problem, you can call GetWatchdog to get it, or simply access it directly at m_watchdog. If you put m_watchdog.SetEnabled(false) in your constructor, that'll guarantee it's disabled.

On the other hand, your buttons for driving the robot forward,backward, etc. for a fixed amount of time will definitely cause problems and MotorSafetyHelper errors. Putting a Wait() in your OperatorControl while loop is a really bad idea, because it stops everything else and waits. It's also not likely to do what you want.

If you have MotorSafety enabled, then your robot drive is expecting a new TankDrive or ArcadeDrive or somethingDrive command every 0.1 seconds. If you don't update it, MotorSafety will disable that motor until you command it again. So you give it that TankDrive(-.3,-.3) command, then wait 2 seconds with a command, which kills your motor, then you command it (0,0).

On the other hand, if you have MotorSafety disable, everything else keeps doing what it was doing just before you hit that button. If your armmotor was going down and you hit the backup button, that armmotor is going to keep going down for two seconds, limit switch or no.

So mostly, you shouldn't be using a Wait() in your OperatorControl loop.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter