|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can anyone create new commands?
Im new at C and is slowly figuring it out. I learned how to use the current commands and is wondering if it is posible to program new commands. Man i have to go to a meeting soon, so if some one can help that would be great and i will be sure to read and express my thanks when i get back.
|
|
#2
|
|||
|
|||
|
Re: Can anyone create new commands?
What do you mean by 'commands?' Are you referring to functions? Or are you referring to the autonomous program provided by FIRST? If you're talking about built-in functions, then you certainly can! The basic format of a function is this:
(replace the items in square brackets with the proper keywords) Code:
[returntype] [functionname]([argtype1] [argname1],[argtype2] [argname2]...){
/*Your code here*/
return [result];
}
Code:
double squareit(double numberToBeSquared){
return numberToBeSquared*numberToBeSquared;
}
|
|
#3
|
|||
|
|||
|
Re: Can anyone create new commands?
No, in the command.h and .c files are a list of...functions, or commands*not too sure* that say: COMMAND, parameter1, parameter2, parameter3. I guess i dont understand how the commands are created and how to create my own commands and set parameters to them. if any one can, please help...
![]() |
|
#4
|
|||
|
|||
|
Re: Can anyone create new commands?
Quote:
|
|
#5
|
|||
|
|||
|
Re: Can anyone create new commands?
I think he's talking about the default autonomous code, which is different. I have not used it, so I don't know.
|
|
#6
|
|||
|
|||
|
Re: Can anyone create new commands?
yes you can 'define' new commands to place in the command.h
in robot.h around line 169 insert new lines that name a command and give a function prototype in robot.c around line 156 insert new lines that will act on the new command (it would look almost exactly like the CMD_KEEP_HEADING block just before it) at the end of robot.c add the function you gave a prototype to in robot.h (you might use the command state structure the other commands use: START, IN_PROGRESS, COMPLETE) don't forget to return a 1 else it will get stuck on that command. Then you can use your new command in the command.h 'script' |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple command_lists | Jon236 | Programming | 8 | 20-01-2005 17:55 |
| How should I create a database of real estate? :) | Ryan M. | Website Design/Showcase | 9 | 09-08-2004 15:27 |
| how to create custom interface | _GP_ | Technical Discussion | 1 | 18-01-2004 21:24 |
| Create a Game Details | Katherine | General Forum | 7 | 06-09-2003 23:44 |
| Voice Activated commands | Amber H. | Technical Discussion | 40 | 03-11-2002 12:40 |