![]() |
User_Autonomous_Code() questions
OK. I'm new to FIRST but not new to C. I'm trying to understand the default FRC code. I see that main is calling User_Autonomous_Code() when the autonomous_mode flag is set and after calling Process_Data_From_Master_uP(). like so:
Code:
while (1) /* This loop will repeat indefinitely. */It seems to me that the if check in main should be something more like this: Code:
while (1) /* This loop will repeat indefinitely. */I want to be sure I'm not misunderstanding anything before I procede. Thanks. Dan Rasmussen |
Re: User_Autonomous_Code() questions
It's not you.
I think there have been quite a few late, late nights at IFI getting this stuff ready, and you know there's always a bug in software. You just may not know what it is yet. We changed this around to where it made sense as you have done. We decided to go through Process_Data_From_Master_uP() to check switches like the competition bit, then do the branch to auto or driver code. Ours looks like: Code:
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */ |
Re: User_Autonomous_Code() questions
I'm not sure about this, so don't quote me, but I believe you are actually able to read the operator inputs once at the start of the match. For instance, assuming that is true, you could have your autonomous function selected by switches that are part of whatever panel you have for the drivers instead of them having to be on the robot.
Of course, maybe I'm wrong and the thing is just incorrectly written... :) |
Re: User_Autonomous_Code() questions
Quote:
|
Re: User_Autonomous_Code() questions
Quote:
|
Re: User_Autonomous_Code() questions
Quote:
|
Re: User_Autonomous_Code() questions
can you help me?
I have pasted a code in the part that says "add your own autonomous code here",. Then I Closed the switch in the competition port, the controls disable, but autonomous didn't run. What should i do? Thanks. |
Re: User_Autonomous_Code() questions
Close the switch for auto mode. Check the doc on IFI's site. But be careful: I already fried our OI doing that ("This is what happens when programmers get bored ...") Fortunately, That was Saturday and we got back Thursday :):):):):).
|
Re: User_Autonomous_Code() questions
Instead of risking frying stuff :), for testing you could use preprossesor directives to make the tests for autonomous mode always true when a certain macro is/isn't defined. Something like this:
main.c (in main()) Code:
while (1) /* This loop will repeat indefinitely. */Code:
#ifndef AUTO_TESTINGCode:
#define AUTO_TESTINGDon't forget to comment the #define out when you're in competition. :D |
| All times are GMT -5. The time now is 04:19. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi