|
Re: Analog Gyro .getAngle() function occasionally giving massive random values
Quote:
Originally Posted by Maxwell777
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
|
Generally speaking, it should be thread-safe except for setup-type functions. E.g. it's not safe to call gyro calibrate() in a separate thread from gyro getAngle(). That said, most robot code doesn't use threads outside of PIDController so there are probably other places where locking may have been missed.
__________________
Author of cscore - WPILib CameraServer for 2017+
Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC
2010 FRC World Champions ( 294, 67, 177)
2007 FTC World Champions (30, 74, 23)
2001 FRC National Champions (71, 294, 125, 365, 279)
|