Go to Post Having the ability, opportunity, and inclination to do manual labor makes you a better engineer. - MrForbes [more]
Home
Go Back   Chief Delphi > Technical > Programming
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
  #4   Spotlight this post!  
Unread 14-01-2009, 22:01
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: C++ Robot: Simple or Iterative?

It really is the case that the SimpleRobot class is designed to have a very straightforward model of the robot. One method for all your autonomous code and another for the teleop code. The Iterative robot was designed to model the older code from previous years.

With SimpleRobot the idea is to write straight-line code to do whatever is needed during the Autonomous period. You are completely in control during that time. One important note: the Autonomous method will keep running at the the end of the autonomous period in the game. It will not stop when the teleop period begins. So it is the programmers responsibility to make sure the Autonomous method returns by the end of the autonomous period. There are methods like IsAutonomous() that you can call or you can use the clock and timers, but be sure to return from the Autonomous method.

IterativeRobot attempts to solve that problem by continuously calling one of its methods over and over again. You write code in the appropriate method that does what it needs to do and returns. When the field (or the switch on your driver station) switches from Autonomous to Teleop, then it will stop calling your AutonomousContinuous() method and start calling your TeleopContinous() method. Your program doesn't have to worry about keeping track of Autonomous vs. Teleop, but you do have to remember what the robot was doing from one call to the next.

For example, if you wanted to drive in a square pattern at the start of Autonomous it would work like this:

IterativeRobot: Your AutonomousContinuous method would be called over and over again during the autonomous period. So you write code that uses some variables to remember from call to call which side of the square it's currently driving or if it's turning. Using those variables the program would set the wheels to either be driving straight or turning. Remembering what the robot is doing is called its state, and this type of program is called a state machine.

SimpleRobot: Your Autonomous function is called once. You write a program that loops 4 times, driving each side of the square, then turning. You should check in the loop if the autonomous period is over by calling the IsAutonomous() method and returning from the Autonomous() method if it is.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
 


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
Demo: Simple robot arm with a PID controller mtomczak Programming 1 17-01-2008 02:17
Iterative Scoring Program TimA Rules/Strategy 1 18-01-2007 21:43
Simple Digital io rfolea Programming 10 18-01-2007 16:22
2 simple questions RDD Rules/Strategy 4 10-01-2007 16:41
simple mistakes birdman Rules/Strategy 8 10-04-2005 23:32


All times are GMT -5. The time now is 12:41.

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