![]() |
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. |
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() |
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. |
Re: Iterative Robot Template
Quote:
|
Re: Iterative Robot Template
Alright makes much more sense. Thanks a ton everyone. Now its time to code it :).
|
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.
|
| All times are GMT -5. The time now is 08:31 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi