Go to Post When a team is composed completely of robot builders and technical people that team cannot exist just like a company cannot exist if it is only made up of engineers. - Garret [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Events   CD-Media   CD-Spy   FRC-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 03-08-2010, 11:02 PM
csshakka csshakka is offline
Registered User
FRC #0818
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Warren, MI
Posts: 21
csshakka is an unknown quantity at this point
Send a message via AIM to csshakka Send a message via MSN to csshakka
Iterative Robot Template

This may be a really dumb question that i overlooked the answer to, but should the drive controls in teleop mode go under the teleopContinuous() function or the teleopPeriodic() function. For simplifying purposes, lets say it would be for a standard tank drive robot with a left and right joystick controlling its movement. I guess my main question is where to code most of the controls and how often the periodic function actually is called.

Thanks in advance for help.

EDIT: Also what types of things would go in the disabled functions. Im assuming it would be things like motors to zero power and things like that.

Last edited by csshakka : 03-08-2010 at 11:04 PM.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-09-2010, 05:54 AM
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: Iterative Robot Template

teleopPeriodic is called about every 50ms. This time period is based upon the data rate of new packets coming from the driver station. New joystick information is received about every 50ms, so there is no reason to update the robot drive more frequently, since the data would be exactly the same as the previous data.

So put your call to tank drive in teleoPeriodic.

Code:
    public void teleopPeriodic()
    {
        // feed your watchdog
        Watchdog.getInstance().feed();
        // drive the robot
        this.robotDrive.tankDrive(leftJoystick, rightJoystick);
    }
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
Reply With Quote
  #3   Spotlight this post!  
Unread 03-09-2010, 08:42 AM
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Iterative Robot Template

yes the teleopPeriodic method is the one that makes most sense for competition. You can assume that each of the periodic functions in the iterative robot class are loops.

So the disabled method is good for handling chores you want taken care of before the robot is enabled in either autonomous or teleop. As you stated you can initialize all of your motors, variables, digi i/o, whatever. Also we are using the disabled method to set our autonomous mode. Pulling a trigger on one of our joy sticks will cycle through our auto modes that will be called once autonomous is entered. Yes the program still reads input even though disabled. You just don't get output to the robot.
__________________
I don't need a signature.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-09-2010, 09:17 AM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 7,823
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Iterative Robot Template

Quote:
Originally Posted by charrisTTI View Post
teleopPeriodic is called about every 50ms. This time period is based upon the data rate of new packets coming from the driver station. New joystick information is received about every 50ms, so there is no reason to update the robot drive more frequently, since the data would be exactly the same as the previous data.
It is called at the rate of the new packets coming from the DS. However, that rate is 50hz (every 20ms).
Reply With Quote
  #5   Spotlight this post!  
Unread 03-09-2010, 09:36 AM
csshakka csshakka is offline
Registered User
FRC #0818
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Warren, MI
Posts: 21
csshakka is an unknown quantity at this point
Send a message via AIM to csshakka Send a message via MSN to csshakka
Re: Iterative Robot Template

Alright makes much more sense. Thanks a ton everyone. Now its time to code it .
Reply With Quote
  #6   Spotlight this post!  
Unread 03-09-2010, 12:40 PM
ideasrule's Avatar
ideasrule ideasrule is offline
Registered User
FRC #0610 (Coyotes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Toronto
Posts: 108
ideasrule is a jewel in the roughideasrule is a jewel in the roughideasrule is a jewel in the roughideasrule is a jewel in the rough
Re: Iterative Robot Template

If you've run drive code on the robot before, I'd strongly suggest testing the code before going into a match. Chances are, no matter how simple the code seems, you'll need to tweak it countless times before getting it to work.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterative Robot Template? jalburty WindRiver C++ 4 04-08-2011 12:57 PM
Autonomous (Iterative) j.cole NI LabVIEW 6 02-12-2010 01:01 AM
Iterative Robot demo mandrews281 WindRiver C++ 0 03-21-2009 02:45 PM
Continuous vs. Autonomous in Iterative Robot Shira WindRiver C++ 4 02-06-2009 03:20 AM
C++ Robot: Simple or Iterative? Abrakadabra Programming 3 01-14-2009 09:01 PM


All times are GMT -5. The time now is 03:40 AM.

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


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