|
Re: Analog Gyro .getAngle() function occasionally giving massive random values
Quote:
Originally Posted by Peter Johnson
Java AnalogGyro.getAngle() is indeed NOT thread-safe as currently written. If you are calling it from multiple threads with no locking protection you can get corrupted results. I'll get a patch submitted that adds "synchronized" to the various AnalogGyro methods, but in the meantime you can add locking yourself around all calls to AnalogGyro and see if that fixes the problem for you.
|
Thanks! I'll try that out. I figured that .getAngle() was thread safe because it returned a primitive type and I didn't think that there was anything too crazy running in the background. Do you know if any other common wpilib stuff that isn't thread safe? I might start going around and locking everything I can lol
__________________
But why?
|