FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

AnalogModule->GetAverageValue() gives wrong results if polled too fast

Joe,

Thank you; I must have stepped through that routine ten times without checking the semaphore - I thought it complain if there was a problem.

I changed the code in AnalogModule.cpp to read:

static SEM_ID semaphore = semMCreate(SEM_DELETE_SAFE | SEM_INVERSION_SAFE | SEM_Q_PRIORITY);

Two questions:

1)  are there any other files that need updating?

2)  once I update them how do I get Wind River to use the updated source files? (Isn't it using WPILib.a now)

Regards,

David

0 Kudos
Message 11 of 13
(634 Views)

David,

1. There are no other files that need to be updated to fix the AI problem.  As noted on the FIRST forums, however, the problem also exists in other subsystems.  If you are wanting to fix those subsystems in your build as well, just grep for semMCreate and make sure each instance is using the corrected options.  The other case that is broken is the "Relay" class.  If you look in DigitalModule.cpp, you can see the TODOs where the semaphores are needed.

2. After you build the new library, you need to run the "Scripts/updateBuiltInLibrary.cmd" in the WPILib source directory after building the WPILib project.  It will replace the files in the install locations of the WindRiver directory.

Since this is rather serious, I'm gonna check with the powers that be about the possibility of another update.

-Joe

0 Kudos
Message 12 of 13
(634 Views)

Does this update fix your problem? http://forums.usfirst.org/showthread.php?t=12174

Be sure the read the disclaimer.

0 Kudos
Message 13 of 13
(634 Views)