Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FIRST Tech Challenge (http://www.chiefdelphi.com/forums/forumdisplay.php?f=146)
-   -   [FTC]: FIXED: Random false starts in Autonomous (http://www.chiefdelphi.com/forums/showthread.php?t=98554)

gotrobot? 30-11-2011 18:43

[FTC]: FIXED: Random false starts in Autonomous
 
For RobotC:

Prior to our regional competition we were experiencing random false starts in our Autonomous program. It simply bypassed the built-in waitForStart(); command for no apparent reason. Eventually we narrowed it down to a combination of the LEGO color sensor and the HiTechnic motor controllers. With both of these enabled the program would randomly bypass the waitForStart(); function. With either one removed it waited for the FCS to issue the start.

Via the RobotC forums we were pointed in the direction of a modification that others had made to the pre-existing code within the joystick.c library. For them, the modification had fixed similar (but not identical) odd behavior related to the joystick packets. Adding the hogCPU/releaseCPU worked for us. No more false starts. If you experience anything similar to this we'd suggest adding this code to joystick.c before spending a long time trying other solutions. The two additional lines are the ones with the comments....


if (nNoMessageCounter > nNoMessageCounterLimit)
{
hogCPU(); //**************************************** take exclusive control
if (!bOverrideJoystickDisabling)
{
bTempUserMode = joystickCopy.UserMode;
bTempStopPgm = joystickCopy.StopPgm;

memset(joystickCopy, 0, sizeof(joystickCopy));

joystickCopy.UserMode = bTempUserMode;
joystickCopy.StopPgm = bTempStopPgm;
joystickCopy.joy1_TopHat = -1;
joystickCopy.joy2_TopHat = -1;
}
bDisconnected = true;
releaseCPU(); //************************** copying is done, relinquish control
}

Hope this helpful to someone.


All times are GMT -5. The time now is 18:54.

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