Go to Post THE GAME PIECES ARE BEARS - JohnSchneider [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 23-09-2014, 16:39
Arbalest007 Arbalest007 is offline
Registered User
FRC #2496
 
Join Date: Sep 2014
Location: Irvine, California
Posts: 19
Arbalest007 is an unknown quantity at this point
Random Rookie Programmer Question About Timer and Watchdog

Hi guys, I just started programming for FRC this year in Java. However, I'm kinda confused over how to effectively use all the methods in the Watchdog() class like the feed method. Should I be using watchdog in the tele-operator section of the class to disable the robot in case I don't move it in a long time...or is it just for enabling safety on the robot before it is switched to autonomous or tele-operated mode? Also, I looked over the "Beginning with Java FRC" guide on Google, but I don't understand what the Timer class/methods are used for (i.e. why do I need to use Timer.delay(xx) within the teleoperated section of the class)?
Reply With Quote
  #2   Spotlight this post!  
Unread 23-09-2014, 17:04
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Random Rookie Programmer Question About Timer and Watchdog

Quote:
Originally Posted by Arbalest007 View Post
Hi guys, I just started programming for FRC this year in Java. However, I'm kinda confused over how to effectively use all the methods in the Watchdog() class like the feed method. Should I be using watchdog in the tele-operator section of the class to disable the robot in case I don't move it in a long time...or is it just for enabling safety on the robot before it is switched to autonomous or tele-operated mode? Also, I looked over the "Beginning with Java FRC" guide on Google, but I don't understand what the Timer class/methods are used for (i.e. why do I need to use Timer.delay(xx) within the teleoperated section of the class)?
You shouldn't have to touch the watchdog. I'm guessing you're seeing the watchdog not fed enough warning.

This is often the result of using Timer.delay in the wrong way.

When you call Timer.delay, it "pauses" the code for that amount of time. To the robot, it is as though you are telling it to close it's eyes and do something for that amount of time.

Your robot does however need to "blink", but I recommend trying out IterativeRobot, because the WPI code will handle that. Only if you're using SimpleRobot would I use Timer.delay at all. (One more piece of advice, a SimpleRobot is not necessarily the simplest to implement, the naming convention tricked me for quite some time)

Here is a previous post where I described how I approach time based tasks.

http://www.chiefdelphi.com/forums/sh...43#post1349743

You'll also notice that there was a post after mine, if you know why not, then you are well along your way....
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 23-09-2014 at 17:15.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-10-2014, 13:40
Cel Skeggs Cel Skeggs is offline
Robot Software Manager Alumnus
AKA: Previously known as Colby
FRC #1540 (The Flaming Chickens)
Team Role: Alumni
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Portland, Oregon, USA
Posts: 107
Cel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of light
Re: Random Rookie Programmer Question About Timer and Watchdog

Quote:
Originally Posted by lineskier View Post
(One more piece of advice, a SimpleRobot is not necessarily the simplest to implement, the naming convention tricked me for quite some time)
Quick note about that - in the 2015 software, it's renamed to SampleRobot to attempt to clarify this issue, as lots of teams have been confused by it.

Also, good explanation!
__________________
Software manager alumnus. Developer of the CCRE, a powerful robot code framework based on dataflow and composibility.
Refer to as she/her/hers. Years of FRC: 2012, 2013, 2014, 2015, 2016. FLL for a few years beforehand.
Team 1540: The Flaming Chickens | Portland, Oregon | Twitter | Facebook
Reply With Quote
  #4   Spotlight this post!  
Unread 05-10-2014, 22:24
lamk lamk is offline
Ken Lam
FRC #4719
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Calgary
Posts: 69
lamk is just really nicelamk is just really nicelamk is just really nicelamk is just really nice
Re: Random Rookie Programmer Question About Timer and Watchdog

Quote:
Originally Posted by Arbalest007 View Post
Hi guys, I just started programming for FRC this year in Java. However, I'm kinda confused over how to effectively use all the methods in the Watchdog() class like the feed method. Should I be using watchdog in the tele-operator section of the class to disable the robot in case I don't move it in a long time...or is it just for enabling safety on the robot before it is switched to autonomous or tele-operated mode? Also, I looked over the "Beginning with Java FRC" guide on Google, but I don't understand what the Timer class/methods are used for (i.e. why do I need to use Timer.delay(xx) within the teleoperated section of the class)?
In simplerobot template. you have to do your own looping. The timer.delay(xx) in teleop is to control the refresh rate. If you don't put in the timer.delay than you will be running the loop as fast as possible and tie up the cpu 100%. We learn this the hardway. In iterativerobot template the looping is done for you.
You want the teleop loop to keep pace with the driver station so each loop coincide with a new package that is send form the driver station. If you loop too fast there is no advantage except tying up your cpu and you will have problem with things like visual processing.. If you loop too slow than the robot will not react fast enough to things like joystick input.
The iterative robot/ driver station refresh at 50 hz ie every 20ms.
Watchdog is now deprecated.
Use motor safety feature instead.
http://wpilib.screenstepslive.com/s/...safety-feature
__________________
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 11:01.

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