|
Re: Feedback Thread: WPILib
One of the things that I found difficult to work with in WPILib was the approach for creating and maintaining threads. There is a good model for this in C++ in the form of the Open Source Thread Building Blocks put out by Intel. There is an O'Reilly book on the TBBs as well. So, it's open source *and* documented :-).
Another issue that I've encountered is that within the Teleop control loop, the Wait() is implemented as a taskDelay. This causes the teleop loop task to go to sleep forcing it to lose contact with the operator. Normally, in a real VxWorks system, we'd have a thread that would be blocked on a binary semaphore and a watchdog timer (via wdCreate/wdStart) that would give the semaphore after the expiration of the timer. Or, create a thread and put it into a timed semTake call. This really relates to the way the code is designed for operating in teleop mode.
Another alternative for this would be to use the semaphore event mechanism to effectively deliver a signal (non real-time hack alert ;-), to allow the teleop loop to continue to run without putting the task to sleep. The concern that I have is that the kids don't realize the effect of using the Wait() call on their code and this makes the cRIO appear to not be fast enough.
HTH,
Mike
|