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