Go to Post Only a few more days till i get to see her again! This is sad you would think I was talking about a chick... no wonder my gf gets jealous. XD - sportzkrazzy [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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,043
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
 


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 06:24.

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