allwpilib icon indicating copy to clipboard operation
allwpilib copied to clipboard

[wpilib] Refactor and clean up ADIS IMU classes

Open Gold856 opened this issue 2 months ago • 0 comments

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)

Gold856 avatar Jun 09 '24 03:06 Gold856