![]() |
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.
|
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]...){Code:
double squareit(double numberToBeSquared){ |
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... :o
|
Re: Can anyone create new commands?
Quote:
|
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.
|
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' |
| All times are GMT -5. The time now is 02:46. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi