Quote:
Originally Posted by Jaci
GetJoystickName and GetJoystickIsXbox both retrieve values from the HALJoystickDescriptor, which stores values in memory ( source 1 source 2). The Joystick Descriptor is updated each control packet as defined by DriverStation::GetData(). This code appears to be common between Java and C++ variants of the library.
A state retrieval doesn't affect the inner loop at all, since state ticking is done by WPILib before user code, and therefore should not cause a loop to slow..
|
Not true for Java... if you look at the Java code most of the methods are marked as 'synchronized'. The DriverStation thread task calls
getData() which goes into HAL a bunch so it's probably not particularly fast (JNI overhead) -- and it's also marked as synchronized, so they'll all block each other in various ways.
I didn't realize that C++ did this differently though, very interesting.