programming codewords

I’m lost. A first time programmer and our team doesn’t know where our sheet of the codewords is. Also, I can’t find anyone who has it. If anybody has the paper and can put it into a reply would be great.

You mean you don’t know how to program. I don’t quite understand your question. If you need help with overall programming in general, feel free to contact via aim(teknobramha).

What I’m trying to say is the sheet with the programming codewords
(you know, the turn left turn right end things) is lost in our group. I’m trying to see if anyone out there has it on their computer and can send it over.

If I am not mistaken, this is what you’re looking for. This is directly from the navigation code released on 1-8-05. Make sure you’re using a gyro and encoders.


   /**********************/
  /* Command Dictionary */
 /**********************/
 
 /*
 The command dictionary is a list of commands that can be put in a 
 sequence to make it easy to program the autonomous motion of the robot.
 Each command has a define statement and a function prototype associated
 with it.  The define value is used in the command list to identify
 the commands.  The function is defined in robot.c  
 
 If you want to add your own commands, create a define with a new number
 and list the function prototype here.  Then go to robot.c to write
 your code.
 
 Each command has 0 to 3 parameters.  Just fill in zeros for unused 
 parameters in the command list. 
 */
 
 /* The NULL command is used to end the command list.  You must
    have a NULL command as the last command in your command list
    so that the command processor knows when to stop. */  
 #define NULL				  0
 
 /* CMD_SHOW_STATE will display the current position and heading
    of the robot to the programming host.  It is useful for debugging
    your driving. It takes no parameters */
 #define CMD_SHOW_STATE		1
 int cmd_show_state(void);
 
 /* CMD_VELOCITY takes one parameter, the velocity in mm/sec.  The 
    robot will remain at this velocity until you give it a CMD_STOP. */
 #define CMD_VELOCITY		  2
 int cmd_velocity(void);
 
 /* CMD_WAIT takes one parameter, the time to wait in milliseconds.  It
    will not let the next command start until that much time has elapsed.
    You might want to use it after a CMD_VELOCITY or CMD_DRIVE to let
    them finish before going on. */
 #define CMD_WAIT			  3
 int cmd_wait(void);
 
 /* CMD_WAIT_UNTIL takes one parameter, the time from the start of the
    match.  The robot will not go on to the next command until that
    much time has elapsed.  This might be useful if you want your robot
    to sit still until 5 seconds into the match (to let the other robots
    get out of the way???). */
 #define CMD_WAIT_UNTIL		4
 int cmd_wait_until(void);
 
 /* CMD_DRIVE takes one parameter, a distance in mm.  The robot will
    drive straight that distance and try to maintain the position. */
 #define CMD_DRIVE			 5
 int cmd_drive(void);
 
 /* CMD_TURN takes two parameters, an angle to turn through and a
    tolerance, both in milliradians.  */
 #define CMD_TURN			  6
 int cmd_turn (void);
 
 /* CMD_GOTO_WAYPOINT is not yet implemented (maybe when we get trig
    functions ;-) */
 #define CMD_GOTO_WAYPOINT	 7
 int cmd_goto_waypoint(void);
 
 /* CMD_SET_POS is not yet implemented (maybe when we get trig
    functions ;-) */
 #define CMD_SET_POS		   8
 int cmd_set_pos(void);
 
 /* CMD_SET_HEADING is not yet implemented (maybe when we get trig
    functions ;-) */
 #define CMD_SET_HEADING	   9
 int cmd_set_heading(void);
 
 /* CMD_WAIT_FOR_BUMP takes no parameters.  It will wait until it sees
    a signal from the bump sensor or the trigger to continue to the next 
    command.  This is useful for debugging by waiting between commands
    until you hit the bump sensor, or the trigger.  It is also useful 
    for driving until you hit something.  */
 #define CMD_WAIT_FOR_BUMP	 10
 int cmd_wait_for_bump(void);
 
 /* CMD_STOP takes no parameters. It just stops driving.  */
 #define CMD_STOP			  11
 int cmd_stop(void);
 
 /* CMD_JUMP takes one parameter a command list position.  It is used
    to jump around in the command list.  Note: the command list starts
    with command number 0.  This is C after all. */
 #define CMD_JUMP			  12
 int cmd_jump(void);
 
 /* CMD_GYRO_BIAS sets the gyro bias.  It takes no parameters.  Run this
    while stopped before using the gyro.  It should calibrate out any
    drift.  */
 #define CMD_GYRO_BIAS		 13
 int cmd_gyro_bias(void);
 
 /* CMD_KEEP_HEADING takes two parameters, a timeout and a tolerance.  It
    is a demonstration of the robot maintaining position and orientation.
    While this command is active, the robot will fight against any attempt
    to move it.  */
 #define CMD_KEEP_HEADING	  14
 int cmd_keep_heading(void);
 

How do I put the keywords into the program? Would it be…

casepoint1:
CMD_VELOCITY: (whatever number I need)

or would it be in a different format?
Please!!! I Need Help! But we don’t have a teacher who knows programming who comes!

You would place them into an array and run a function that uses the array like so:
commands.h:


struct commands command_list] = {
/*   Command			  parm 1	 parm 2   parm 3   */
{CMD_GYRO_BIAS,			   0,		0,	  0},
{CMD_WAIT_FOR_BUMP,		 100,		0,	  0},
{CMD_WAIT,				 1000,		0,	  0},
{CMD_TURN,	   -1571L,	  100,	  0},
{CMD_WAIT_FOR_BUMP,		 100,		0,	  0},
{CMD_WAIT,				 1000,		0,	  0},
{CMD_TURN,		1571,	  100,	  0},
{CMD_JUMP,					1,		0,	  0},
{NULL,						0,		0,	  0}
};

Do you know how to say that in lay man’s terms?

And are their other codes that don’t use the gyro and encoder?
Because I use the
casepoint1:
pwm01 = 240
pwm02 = 170
break;

format…

If you want to do a state machine (use your switch statement), then you can’t use the scripting code which comes with the default code.

BRAIN!!! THE FLEXNARG DOES THAT MEAN??? :ahh:

So… calm… down…
How would I put the wheel to go a certain distance? And can you show what it would look like.

I think you’ll be better off if you IM me or something. My screenname is TeknoBramha or look at my profile for more info.