Go to Post that is one of the funniest non-photoshoped pictures of my father i have seen... - Lil' Lavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-01-2005, 10:45
Jakenan Jakenan is offline
Registered User
AKA: Jacob Rojas
FRC #0457 (Grease Monkeys)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2001
Location: San Antonio, Tx
Posts: 17
Jakenan is an unknown quantity at this point
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   Spotlight this post!  
Unread 22-01-2005, 11:11
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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];
}
For example:
Code:
double squareit(double numberToBeSquared){
return numberToBeSquared*numberToBeSquared;
}
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #3   Spotlight this post!  
Unread 22-01-2005, 17:47
Jakenan Jakenan is offline
Registered User
AKA: Jacob Rojas
FRC #0457 (Grease Monkeys)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2001
Location: San Antonio, Tx
Posts: 17
Jakenan is an unknown quantity at this point
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   Spotlight this post!  
Unread 22-01-2005, 19:29
ahmed ahmed is offline
synOrange
#0843 (White Oaks Wildcats)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Canada, yo!
Posts: 42
ahmed is an unknown quantity at this point
Send a message via AIM to ahmed Send a message via MSN to ahmed Send a message via Yahoo to ahmed
Re: Can anyone create new commands?

Quote:
Originally Posted by Jakenan
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...
What you are refering to sound much like what steven114 just explained
  #5   Spotlight this post!  
Unread 22-01-2005, 20:20
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
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.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #6   Spotlight this post!  
Unread 22-01-2005, 21:38
iscrc2 iscrc2 is offline
Registered User
#0568 (Nerds of the North)
 
Join Date: Jan 2002
Location: Anchorage, Alaska
Posts: 28
iscrc2 is an unknown quantity at this point
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'
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 10:58.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi