View Single Post
  #4   Spotlight this post!  
Unread 12-02-2005, 10:25
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: programming codewords

Quote:
Originally Posted by black mage
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.
Code:
   /**********************/
  /* 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);
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson