|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
|||
|
|||
|
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. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|