wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.03k stars 606 forks source link

[wpilib] Refactor and clean up ADIS IMU classes #6719

Open Gold856 opened 3 weeks ago

Gold856 commented 3 weeks ago

Create acquire thread with method reference instead of Runnable class Clean up comments and bad Javadoc (removed useless doc stubs, used single line comments instead of multi-line everywhere, removed low value comments) Clean up variable declarations (declared and assigned variables when needed instead of declaring upfront and assigning later, made needsFlash a local in Java) Remove unused gyro data variables (mostly average gyro data in Java) Remove and/or inline a bunch of the conversion functions Make toInt in Java take four ints instead of varargs to reduce allocations Remove unnecessary parentheses and casts Use InputModulus or angleModulus and remove custom angle wrapping Use hypotf instead of manual calculation Remove a bunch of warning suppressions as they were either fixed or aren't needed Call reset from calibrate in Java (change not done in C++ because I'm not sure how to do recursive locks) Use array initialization syntax when possible and remove ByteBuffer usage Remove duplicated branch logic Move object creation to ctor, allowing some null checks to be removed (technically allows for NPEs when calling methods after calling close(), but that's basically UB anyways)