Go to Post When twenty people tell you your hair is on fire, you don't need to look into a mirror to find out they're right. - IndySam [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-02-2016, 20:08
Ganda1f Ganda1f is offline
Registered User
FRC #0074
 
Join Date: Feb 2015
Location: Holland, MI
Posts: 1
Ganda1f is an unknown quantity at this point
Watchdog Function Not Functioning

Greetings!

We're with Team 74 C.H.A.O.S., and this year we have decided to switch from using LabVIEW to Python. It's been a little bit bumpy, but for the most part, all is well.
We're having an issue whenever we enable teleop, and both the Driver Station and our Simulator is saying the following:
"Output not updated often enough."
We did some research, and discovered the idea of a "Watchdog" function. However, we couldn't find this function anywhere in the wpilib. The closest thing that we found was the "feed" function, along with the setEnableSafety and the setExpiration function. At first, we tried using setExpiration in conjunction with the feed function, but we continued to have the "Output not updated often enough." issue.
In the end, we gave up, and tried to disable this option by doing the following:
"self.lfmotor.setEnableSafety(False)", where lfmotor is one of our respective motors.
AND STIll, we had the updating issue.

Any help would be greatly appreciated!

Thanks,

Will
Team 74 C.H.A.O.S.
Reply With Quote
  #2   Spotlight this post!  
Unread 09-02-2016, 20:25
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Watchdog Function Not Functioning

Can you post your code?
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2016, 00:09
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,040
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Watchdog Function Not Functioning

Hey Will,

WPILib has the motor safety stuff built in and enabled for RobotDrive to make it harder for the robot to do something like go into an infinite loop and have all of the motors going at full blast.

Basically, if you don't tell the motors to do something within 100ms or so, then this error will occur. You can solve it by ensuring that you do something with robot drive each time teleopPeriodic is called.

You can run the following code in the simulator to demonstrate the problem and its solution:

Code:
import wpilib

class MyRobot(wpilib.IterativeRobot):

    def robotInit(self):
        self.joystick = wpilib.Joystick(0)
        self.robot_drive = wpilib.RobotDrive(1,2)

    def teleopPeriodic(self):
        if not self.joystick.getTrigger():
            self.robot_drive.arcadeDrive(self.joystick)

if __name__ == '__main__':
    wpilib.run(MyRobot)
If you run this code and stick it in teleop, then all is well, as robot drive is getting called on each loop. However, if you enable the trigger button on the first joystick, then the annoying robot safety output messages will start appearing -- because you're no longer calling robot drive.

Does that make sense?
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 19:51.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi