View Single Post
  #8   Spotlight this post!  
Unread 20-01-2005, 15:58
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Multiple command_lists

What I did was redid the code so that it accessed a pointer to the array, than made that pointer an argument:

Code:
struct commands *command_list;
//...
void robot_control(struct commands *script)
{
robot_command(script);
robot_timer();
robot_position();
}

void robot_command(struct commands *script)
{
//...
}
Of course, I also macro'ed access to the elements in the array, which makes such changes easy:
Code:
#define GET_COMMAND(index) command_list[(index)]
#define CUR_COMMAND GET_COMMAND(current_command)
#define COMMAND CUR_COMMAND.command
#define PARAM1 CUR_COMMAND.parm_1
#define PARAM2 CUR_COMMAND.parm_2
#define PARAM3 CUR_COMMAND.parm_3
So my autonomous mode is now:
Code:
    robot_control(default_script);
After you set all of this up, you can easily add something to select which mode.