Quote:
Originally Posted by davidalln
... autonomous this year is a series of drive->kick->drive->kick instructions coded in a linear fashion. However, this game does create some depth in autonomous mode with the introduction of the three zones: you have to program the robot to successfully score whether there be one, two, or three balls near, mid-range, or far.
Therefore, this is the perfect year for a sort of modular approach to autonomous: i.e., the ability to code general functions such as "drive to initial ball" or "turn towards target" or "kick ball" and have an external source such as a text file or an array of variables determine which actions get done in what order.
|
Since 2006, Team 1519 has broken our autonomous programs down into a series of more general specific operations, exactly like the ones you describe. This actions are the "instructions" that we want an autonomous program to perform. Our autonomous programs are then collections of these "instructions" in a specific sequence. Once each of the individual instructions is written and debugged, these can be quickly composed into a multitude of variations of autonomous programs.
Below are the "instructions" we have implemented this year:
- DELAY(delay)
- DRIVE_STRAIGHT(distance, power)
- DRIVE_STRAIGHT_UNTIL_TILT(power, tilt)
- DRIVE_STRAIGHT_FOR_TIME(power, time)
- DRIVE_STRAIGHT_UNTIL_BALL(power, time)
- KICK_STRENGTH(strength)
- KICK()
- KICK_AND_WAIT()
- KICK_WITH_AIM()
- KICK_WITH_AIM_AND_WAIT()
- SPIN_TO(heading, power)
- SPIN_BY(heading, power)
- STOP()
We are coding in C++. Each of the above "instructions" is interpreted by a "virtual machine" that we have that runs during autonomous, and executes a series of the above instructions in sequence.
As of right now, we have 15 different autonomous programs which are built up of lesser "instructions" such as the ones you describe. I think we have only actually used about 6 of these in real matches, but we have tested the others on the practice field so that they are ready to go when needed. The entire set of autonomous programs is always programmed into the robot -- the drive team selects the autonomous program to be run immediately before each match.
Using the above instructions, our 5-ball autonomous routine is as follows:
Code:
// Kick 3 from the far zone, cross the bump and kick 2 from the center zone
AutonomousInstruction *code[] = {
KICK_STRENGTH(KICK_STRENGTH_FAR1),
DELAY(1.0),
DRIVE_STRAIGHT(18, DEF_SPEED),
KICK_AND_WAIT(),
DELAY(1.0),
KICK_STRENGTH(KICK_STRENGTH_FAR2),
DRIVE_STRAIGHT(36, DEF_SPEED),
KICK_AND_WAIT(),
DELAY(1.0),
KICK_STRENGTH(KICK_STRENGTH_FAR3),
DRIVE_STRAIGHT(36, DEF_SPEED),
KICK_AND_WAIT(),
KICK_STRENGTH(KICK_STRENGTH_MID1),
DRIVE_STRAIGHT(155, 0.55),
KICK_AND_WAIT(),
DELAY(1.0),
KICK_STRENGTH(KICK_STRENGTH_MID2),
DRIVE_STRAIGHT(36, DEF_SPEED),
KICK_AND_WAIT(),
STOP()
};
With the above instruction set, we can quickly build up a new autonomous program at the tournament depending up on alliance needs and have moderate confidence that it could work even the first time we try it. However, rather than wait until at the tournament to implement a new autonomous program, we've tried to anticipate what programs could be needed and test them in advance. We haven't had to do it yet this year, but have added new programs in past years in order to implement a specific alliance strategy.
To get started with this, I would first suggest coding up a few of the general functions you listed, such as "drive to initial ball" or "turn towards target" or "kick ball". (Actually, all three of those are instructions in our instruction set, albeit with slightly different names.) Once you have the individual instructions implemented, you could hard-code the sequence of general functions as an "autonomous program." Then, after you have that working, you would add a "virtual machine" to step through your instructions to create the larger "autonomous program."
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"