OCCRA
Go to Post I wonder if we sang songs to Bill Miller if that would get TIMS opened sooner, like the way it worked to wring game hints out of Dave Laverly. - rsisk [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-10-2005, 11:01 PM
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
None #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 665
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Send a message via AIM to Chris_Elston Send a message via Yahoo to Chris_Elston
If statement in .h file or Indirect addressing? Kevin NAV code...

Ok...so I am not sure how to explain what I need but I know what I want to do.

I am helping our team program this year and really this is the first time I've dabble in C code. I normally program PLCs (programmable logic controllers)...anyway...

I noticed that Kevins nav code uses a commands.h file which is a structured something to send commands in a list format to the robot.c file. Very slick and easy. We've made our own functions and commands for our automous mode.

What I'd like to do is alter this with some inputs to create multi automous modes. We have all the inputs selections working but not sure what would be the best approach in C code to do what we need.

I want to do something like this:


Code:
if (input = 1)
    {
    struct commands command_list[] = {

    /*   Command              parm 1     parm 2   parm 3   */

    {CMD_WAIT,                 1000,        0,      0},
    {CMD_DRIVE,                1500,        0,      0},
    {CMD_WAIT,                 4000,        0,      0},
    }
};

Of course that's not exactly legal in C code....

So if I was doing this in a PLC, I might use what is called indirect addressing, or assigning a varaible to a pointer.

Like:

struct commands command_list*myvarible*[] =

so if myvarible is equal to 1 then run the commands in list #1. If myvarible is equal to 2 then run the commands in list #2.

Is there such a thing like this in C Code?

I hope that makes sense...
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
 


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
Example gyro code released. Kevin Watson Programming 60 03-17-2005 06:32 PM
Updated: Serial Port Driver Code Kevin Watson Programming 4 02-05-2005 06:39 PM
Kevin Watson's Kick-off Demo Code! Mr. Lim Programming 27 01-22-2005 03:38 AM
heres the code. y this not working omega Programming 16 03-31-2004 03:18 PM
File Sharing and Revision Tracking Madison FIRST-related Organizations 14 06-04-2003 06:01 PM


All times are GMT -5. The time now is 05:37 PM.

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


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