Go to Post Figuring out how to do something is half of the fun. - Mike [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-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
  #3   Spotlight this post!  
Unread 09-01-2012, 11:37
theprgramerdude theprgramerdude is offline
WPI Freshman
AKA: Alex
FRC #2503 (Warrior Robotics)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Brainerd, Minnesota
Posts: 347
theprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud of
Re: Help with C robot example

As a quick question, why not develop using C++ instead?

For developing the robot programs, there's no main method because... I'm not entirely sure why, but when using C, the WPILibrary enables you to not have to worry about game state, and do things in something akin to the main() method. The system handles all the field management sysem interfacing and checking of all other systems, and so I guess using a main method to start the program would be counter-intuitive as you'd lose all that support if you took direct control of it.

In short, the system starts up on it's own with software provided by FIRST; by including WPILib, all you need to do is provide the initialization code, and the system will automatically call the functions autonomous() and operatorControl() for you when those periods are detected, all that's needed to be done for control is put the control code per period in each code block.

I.E I would initialize two jaguars, jag1 = new CJaguar(port) or something like that, jag2...
CAutonomous(){
jag1.set(power);
jag2.set(power);
Wait(5);
}
The autonomous method is automatically called by the system, and it'll run your commands. In this case, it'll set each jaguar to the power level, and drive for 5 seconds while the user program waits to resume.
__________________
Attending: MN Duluth Regional
 


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


All times are GMT -5. The time now is 15:16.

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