From 546bf00199da92bb8f980e000e302a7eee478c8b Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 6 Oct 2024 08:53:44 -0400 Subject: [PATCH 1/7] Added SysID routine overloads that support custom units --- .../first/wpilibj/sysid/SysIdRoutineLog.java | 138 ++++++++++++++---- 1 file changed, 107 insertions(+), 31 deletions(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java index 82c9ed9b05f..fdc3a1111a8 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java @@ -4,14 +4,7 @@ package edu.wpi.first.wpilibj.sysid; -import static edu.wpi.first.units.Units.Amps; -import static edu.wpi.first.units.Units.Meters; -import static edu.wpi.first.units.Units.MetersPerSecond; -import static edu.wpi.first.units.Units.Rotations; -import static edu.wpi.first.units.Units.RotationsPerSecond; -import static edu.wpi.first.units.Units.Second; -import static edu.wpi.first.units.Units.Volts; - +import edu.wpi.first.units.*; import edu.wpi.first.units.measure.Angle; import edu.wpi.first.units.measure.AngularAcceleration; import edu.wpi.first.units.measure.AngularVelocity; @@ -26,6 +19,8 @@ import java.util.HashMap; import java.util.Map; +import static edu.wpi.first.units.Units.*; + /** * Utility for logging data from a SysId test routine. Each complete routine (quasistatic and * dynamic, forward and reverse) should have its own SysIdRoutineLog instance, with a unique log @@ -111,57 +106,106 @@ public MotorLog value(String name, double value, String unit) { } /** - * Log the voltage applied to the motor. + * Log the voltage applied to the motor(in volts). * * @param voltage The voltage to record. * @return The motor log (for call chaining). */ public MotorLog voltage(Voltage voltage) { - return value("voltage", voltage.in(Volts), Volts.name()); + return voltage(voltage, Volts); } /** - * Log the linear position of the motor. + * Log the voltage applied to the motor. + * + * @param voltage The voltage to record. + * @param unit The unit to log the voltage in. + * @return The motor log (for call chaining). + */ + public MotorLog voltage(Voltage voltage, VoltageUnit unit) { + return value("voltage", voltage.in(unit), unit.name()); + } + + /** + * Log the linear position of the motor(in meters). * * @param position The linear position to record. * @return The motor log (for call chaining). */ public MotorLog linearPosition(Distance position) { - return value("position", position.in(Meters), Meters.name()); + return linearPosition(position, Meters); + } + + /** + * Log the linear position of the motor. + * + * @param position The linear position to record. + * @param unit The unit to log the position in. + * @return The motor log (for call chaining). + */ + public MotorLog linearPosition(Distance position, DistanceUnit unit) { + return value("position", position.in(unit), unit.name()); } + /** + * Log the angular position of the motor(in rotations). + * + * @param position The angular position to record. + * @return The motor log (for call chaining). + */ + public MotorLog angularPosition(Angle position) { return angularPosition(position, Rotations); } + /** * Log the angular position of the motor. * * @param position The angular position to record. + * @param unit The unit to log the position in. * @return The motor log (for call chaining). */ - public MotorLog angularPosition(Angle position) { - return value("position", position.in(Rotations), Rotations.name()); + public MotorLog angularPosition(Angle position, AngleUnit unit) { + return value("position", position.in(unit), unit.name()); } + /** + * Log the linear velocity of the motor(in meters per second). + * + * @param velocity The linear velocity to record. + * @return The motor log (for call chaining). + */ + public MotorLog linearVelocity(LinearVelocity velocity) { return linearVelocity(velocity, MetersPerSecond); } + /** * Log the linear velocity of the motor. * * @param velocity The linear velocity to record. + * @param unit The unit to log the velocity in. * @return The motor log (for call chaining). */ - public MotorLog linearVelocity(LinearVelocity velocity) { - return value("velocity", velocity.in(MetersPerSecond), MetersPerSecond.name()); + public MotorLog linearVelocity(LinearVelocity velocity, LinearVelocityUnit unit) { + return value("velocity", velocity.in(unit), unit.name()); } + /** + * Log the angular velocity of the motor(in rotations per second). + * + * @param velocity The angular velocity to record. + * @return The motor log (for call chaining). + */ + public MotorLog angularVelocity(AngularVelocity velocity) { return angularVelocity(velocity, RotationsPerSecond); } + /** * Log the angular velocity of the motor. * * @param velocity The angular velocity to record. + * @param unit The unit to log the velocity in. * @return The motor log (for call chaining). */ - public MotorLog angularVelocity(AngularVelocity velocity) { - return value("velocity", velocity.in(RotationsPerSecond), RotationsPerSecond.name()); + public MotorLog angularVelocity(AngularVelocity velocity, AngularVelocityUnit unit) { + return value("velocity", velocity.in(unit), unit.name()); } /** - * Log the linear acceleration of the motor. + * Log the linear acceleration of the motor(in meters per second squared). * *

This is optional; SysId can perform an accurate fit without it. * @@ -169,14 +213,24 @@ public MotorLog angularVelocity(AngularVelocity velocity) { * @return The motor log (for call chaining). */ public MotorLog linearAcceleration(LinearAcceleration acceleration) { - return value( - "acceleration", - acceleration.in(MetersPerSecond.per(Second)), - MetersPerSecond.per(Second).name()); + return linearAcceleration(acceleration, MetersPerSecondPerSecond); } /** - * Log the angular acceleration of the motor. + * Log the linear acceleration of the motor. + * + *

This is optional; SysId can perform an accurate fit without it. + * + * @param acceleration The linear acceleration to record. + * @param unit The unit to log the acceleration in. + * @return The motor log (for call chaining). + */ + public MotorLog linearAcceleration(LinearAcceleration acceleration, LinearAccelerationUnit unit) { + return value("acceleration", acceleration.in(unit), unit.name()); + } + + /** + * Log the angular acceleration of the motor(in rotations per second squared). * *

This is optional; SysId can perform an accurate fit without it. * @@ -184,14 +238,24 @@ public MotorLog linearAcceleration(LinearAcceleration acceleration) { * @return The motor log (for call chaining). */ public MotorLog angularAcceleration(AngularAcceleration acceleration) { - return value( - "acceleration", - acceleration.in(RotationsPerSecond.per(Second)), - RotationsPerSecond.per(Second).name()); + return angularAcceleration(acceleration, RotationsPerSecondPerSecond); } /** - * Log the current applied to the motor. + * Log the angular acceleration of the motor. + * + *

This is optional; SysId can perform an accurate fit without it. + * + * @param acceleration The angular acceleration to record. + * @param unit The unit to log the acceleration in. + * @return The motor log (for call chaining). + */ + public MotorLog angularAcceleration(AngularAcceleration acceleration, AngularAccelerationUnit unit) { + return value("acceleration", acceleration.in(unit), unit.name()); + } + + /** + * Log the current applied to the motor(in amps). * *

This is optional; SysId can perform an accurate fit without it. * @@ -199,8 +263,20 @@ public MotorLog angularAcceleration(AngularAcceleration acceleration) { * @return The motor log (for call chaining). */ public MotorLog current(Current current) { - value("current", current.in(Amps), Amps.name()); - return this; + return current(current, Amps); + } + + /** + * Log the current applied to the motor. + * + *

This is optional; SysId can perform an accurate fit without it. + * + * @param current The current to record. + * @param unit The unit to log the current in. + * @return The motor log (for call chaining). + */ + public MotorLog current(Current current, CurrentUnit unit) { + return value("current", current.in(unit), unit.name()); } } From e9c99c6c2246a97f511c2f8a20a2ec6d4099013a Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 6 Oct 2024 09:23:24 -0400 Subject: [PATCH 2/7] Added C++ "overloads"(switched to templates for type defs) --- .../include/frc/sysid/SysIdRoutineLog.h | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h b/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h index 5e727169068..1bbca2fdf5b 100644 --- a/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h +++ b/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h @@ -64,7 +64,8 @@ class SysIdRoutineLog { * @param voltage The voltage to record. * @return The motor log (for call chaining). */ - MotorLog& voltage(units::volt_t voltage) { + template + MotorLog& voltage(U voltage) { return value("voltage", voltage.value(), voltage.name()); } @@ -74,7 +75,8 @@ class SysIdRoutineLog { * @param position The linear position to record. * @return The motor log (for call chaining). */ - MotorLog& position(units::meter_t position) { + template + MotorLog& position(U position) { return value("position", position.value(), position.name()); } @@ -84,7 +86,8 @@ class SysIdRoutineLog { * @param position The angular position to record. * @return The motor log (for call chaining). */ - MotorLog& position(units::turn_t position) { + template + MotorLog& position(U position) { return value("position", position.value(), position.name()); } @@ -94,7 +97,8 @@ class SysIdRoutineLog { * @param velocity The linear velocity to record. * @return The motor log (for call chaining). */ - MotorLog& velocity(units::meters_per_second_t velocity) { + template + MotorLog& velocity(U velocity) { return value("velocity", velocity.value(), velocity.name()); } @@ -104,7 +108,8 @@ class SysIdRoutineLog { * @param velocity The angular velocity to record. * @return The motor log (for call chaining). */ - MotorLog& velocity(units::turns_per_second_t velocity) { + template + MotorLog& velocity(U velocity) { return value("velocity", velocity.value(), velocity.name()); } @@ -116,7 +121,8 @@ class SysIdRoutineLog { * @param acceleration The linear acceleration to record. * @return The motor log (for call chaining). */ - MotorLog& acceleration(units::meters_per_second_squared_t acceleration) { + template + MotorLog& acceleration(U acceleration) { return value("acceleration", acceleration.value(), acceleration.name()); } @@ -128,7 +134,8 @@ class SysIdRoutineLog { * @param acceleration The angular acceleration to record. * @return The motor log (for call chaining). */ - MotorLog& acceleration(units::turns_per_second_squared_t acceleration) { + template + MotorLog& acceleration(U acceleration) { return value("acceleration", acceleration.value(), acceleration.name()); } @@ -140,7 +147,8 @@ class SysIdRoutineLog { * @param current The current to record. * @return The motor log (for call chaining). */ - MotorLog& current(units::ampere_t current) { + template + MotorLog& current(U current) { return value("current", current.value(), current.name()); } From 1632c2985248c01da04dbec63ab35b69c8a4224b Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 6 Oct 2024 17:50:05 -0400 Subject: [PATCH 3/7] Linting and bugfixes --- .../include/frc/sysid/SysIdRoutineLog.h | 48 ++++++++++++------- .../first/wpilibj/sysid/SysIdRoutineLog.java | 31 +++++++++--- 2 files changed, 57 insertions(+), 22 deletions(-) diff --git a/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h b/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h index 1bbca2fdf5b..1e8dff50fad 100644 --- a/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h +++ b/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h @@ -62,55 +62,65 @@ class SysIdRoutineLog { * Log the voltage applied to the motor. * * @param voltage The voltage to record. + * @param U The unit of the recorded value; defaults to volts. * @return The motor log (for call chaining). */ template - MotorLog& voltage(U voltage) { - return value("voltage", voltage.value(), voltage.name()); + MotorLog& voltage(units::volt_t voltage) { + U converted { voltage }; + return value("voltage", converted.value(), converted.name()); } /** * Log the linear position of the motor. * * @param position The linear position to record. + * @param U The unit of the recorded value; defaults to meters. * @return The motor log (for call chaining). */ template - MotorLog& position(U position) { - return value("position", position.value(), position.name()); + MotorLog& position(units::meter_t position) { + U converted { position }; + return value("position", converted.value(), converted.name()); } /** * Log the angular position of the motor. * * @param position The angular position to record. + * @param U The unit of the recorded value; defaults to volts. * @return The motor log (for call chaining). */ template - MotorLog& position(U position) { - return value("position", position.value(), position.name()); + MotorLog& position(units::turn_t position) { + U converted { position }; + return value("position", converted.value(), converted.name()); } /** * Log the linear velocity of the motor. * * @param velocity The linear velocity to record. + * @param U The unit of the recorded value; defaults to meters/second. * @return The motor log (for call chaining). */ template - MotorLog& velocity(U velocity) { - return value("velocity", velocity.value(), velocity.name()); + MotorLog& velocity(units::meters_per_second_t velocity) { + U converted { velocity }; + return value("velocity", converted.value(), converted.name()); } /** * Log the angular velocity of the motor. * * @param velocity The angular velocity to record. + * @param U The unit of the recorded value; defaults to turns/second. * @return The motor log (for call chaining). */ template - MotorLog& velocity(U velocity) { - return value("velocity", velocity.value(), velocity.name()); + MotorLog& velocity(units::turns_per_second_t velocity) { + U converted { velocity }; + return value("velocity", converted.value(), converted.name()); } /** @@ -119,11 +129,13 @@ class SysIdRoutineLog { * This is optional; SysId can perform an accurate fit without it. * * @param acceleration The linear acceleration to record. + * @param U The unit of the recorded value; defaults to meters/second^2. * @return The motor log (for call chaining). */ template - MotorLog& acceleration(U acceleration) { - return value("acceleration", acceleration.value(), acceleration.name()); + MotorLog& acceleration(units::meters_per_second_squared_t acceleration) { + U converted { acceleration }; + return value("acceleration", converted.value(), converted.name()); } /** @@ -132,11 +144,13 @@ class SysIdRoutineLog { * This is optional; SysId can perform an accurate fit without it. * * @param acceleration The angular acceleration to record. + * @param U The unit of the recorded value; defaults to turns/second^2. * @return The motor log (for call chaining). */ template - MotorLog& acceleration(U acceleration) { - return value("acceleration", acceleration.value(), acceleration.name()); + MotorLog& acceleration(units::turns_per_second_squared_t acceleration) { + U converted { acceleration }; + return value("acceleration", converted.value(), converted.name()); } /** @@ -145,11 +159,13 @@ class SysIdRoutineLog { * This is optional; SysId can perform an accurate fit without it. * * @param current The current to record. + * @param U The unit of the recorded value; defaults to amperes. * @return The motor log (for call chaining). */ template - MotorLog& current(U current) { - return value("current", current.value(), current.name()); + MotorLog& current(units::ampere_t current) { + U converted { current }; + return value("current", converted.value(), converted.name()); } private: diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java index fdc3a1111a8..9de876e716c 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java @@ -4,7 +4,14 @@ package edu.wpi.first.wpilibj.sysid; -import edu.wpi.first.units.*; +import edu.wpi.first.units.AngleUnit; +import edu.wpi.first.units.DistanceUnit; +import edu.wpi.first.units.AngularVelocityUnit; +import edu.wpi.first.units.LinearVelocityUnit; +import edu.wpi.first.units.AngularAccelerationUnit; +import edu.wpi.first.units.LinearAccelerationUnit; +import edu.wpi.first.units.CurrentUnit; +import edu.wpi.first.units.VoltageUnit; import edu.wpi.first.units.measure.Angle; import edu.wpi.first.units.measure.AngularAcceleration; import edu.wpi.first.units.measure.AngularVelocity; @@ -153,7 +160,9 @@ public MotorLog linearPosition(Distance position, DistanceUnit unit) { * @param position The angular position to record. * @return The motor log (for call chaining). */ - public MotorLog angularPosition(Angle position) { return angularPosition(position, Rotations); } + public MotorLog angularPosition(Angle position) { + return angularPosition(position, Rotations); + } /** * Log the angular position of the motor. @@ -172,7 +181,9 @@ public MotorLog angularPosition(Angle position, AngleUnit unit) { * @param velocity The linear velocity to record. * @return The motor log (for call chaining). */ - public MotorLog linearVelocity(LinearVelocity velocity) { return linearVelocity(velocity, MetersPerSecond); } + public MotorLog linearVelocity(LinearVelocity velocity) { + return linearVelocity(velocity, MetersPerSecond); + } /** * Log the linear velocity of the motor. @@ -191,7 +202,9 @@ public MotorLog linearVelocity(LinearVelocity velocity, LinearVelocityUnit unit) * @param velocity The angular velocity to record. * @return The motor log (for call chaining). */ - public MotorLog angularVelocity(AngularVelocity velocity) { return angularVelocity(velocity, RotationsPerSecond); } + public MotorLog angularVelocity(AngularVelocity velocity) { + return angularVelocity(velocity, RotationsPerSecond); + } /** * Log the angular velocity of the motor. @@ -225,7 +238,10 @@ public MotorLog linearAcceleration(LinearAcceleration acceleration) { * @param unit The unit to log the acceleration in. * @return The motor log (for call chaining). */ - public MotorLog linearAcceleration(LinearAcceleration acceleration, LinearAccelerationUnit unit) { + public MotorLog linearAcceleration( + LinearAcceleration acceleration, + LinearAccelerationUnit unit + ) { return value("acceleration", acceleration.in(unit), unit.name()); } @@ -250,7 +266,10 @@ public MotorLog angularAcceleration(AngularAcceleration acceleration) { * @param unit The unit to log the acceleration in. * @return The motor log (for call chaining). */ - public MotorLog angularAcceleration(AngularAcceleration acceleration, AngularAccelerationUnit unit) { + public MotorLog angularAcceleration( + AngularAcceleration acceleration, + AngularAccelerationUnit unit + ) { return value("acceleration", acceleration.in(unit), unit.name()); } From 0554c7dfd229d458fc23da927a53b8f6517bfcde Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 6 Oct 2024 20:44:38 -0400 Subject: [PATCH 4/7] More c++ linting changes --- .../include/frc/sysid/SysIdRoutineLog.h | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h b/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h index 1e8dff50fad..0fd863a2e11 100644 --- a/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h +++ b/wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h @@ -61,65 +61,75 @@ class SysIdRoutineLog { /** * Log the voltage applied to the motor. * + * The value is recorded in volts by default; + * to change this, specify your target unit as a generic bound. + * * @param voltage The voltage to record. - * @param U The unit of the recorded value; defaults to volts. * @return The motor log (for call chaining). */ template MotorLog& voltage(units::volt_t voltage) { - U converted { voltage }; + U converted{voltage}; return value("voltage", converted.value(), converted.name()); } /** * Log the linear position of the motor. * + * The value is recorded in meters by default; + * to change this, specify your target unit as a generic bound. + * * @param position The linear position to record. - * @param U The unit of the recorded value; defaults to meters. * @return The motor log (for call chaining). */ template MotorLog& position(units::meter_t position) { - U converted { position }; + U converted{position}; return value("position", converted.value(), converted.name()); } /** * Log the angular position of the motor. * + * The value is recorded in rotations by default; + * to change this, specify your target unit as a generic bound. + * * @param position The angular position to record. - * @param U The unit of the recorded value; defaults to volts. * @return The motor log (for call chaining). */ template MotorLog& position(units::turn_t position) { - U converted { position }; + U converted{position}; return value("position", converted.value(), converted.name()); } /** * Log the linear velocity of the motor. * + * The value is recorded in meters/second by default; + * to change this, specify your target unit as a generic bound. + * * @param velocity The linear velocity to record. - * @param U The unit of the recorded value; defaults to meters/second. * @return The motor log (for call chaining). */ template MotorLog& velocity(units::meters_per_second_t velocity) { - U converted { velocity }; + U converted{velocity}; return value("velocity", converted.value(), converted.name()); } /** * Log the angular velocity of the motor. * + * The value is recorded in rotations/second by default; + * to change this, specify your target unit as a generic bound. + * * @param velocity The angular velocity to record. - * @param U The unit of the recorded value; defaults to turns/second. * @return The motor log (for call chaining). */ template MotorLog& velocity(units::turns_per_second_t velocity) { - U converted { velocity }; + U converted{velocity}; return value("velocity", converted.value(), converted.name()); } @@ -128,13 +138,15 @@ class SysIdRoutineLog { * * This is optional; SysId can perform an accurate fit without it. * + * The value is recorded in meters/second^2 by default; + * to change this, specify your target unit as a generic bound. + * * @param acceleration The linear acceleration to record. - * @param U The unit of the recorded value; defaults to meters/second^2. * @return The motor log (for call chaining). */ template MotorLog& acceleration(units::meters_per_second_squared_t acceleration) { - U converted { acceleration }; + U converted{acceleration}; return value("acceleration", converted.value(), converted.name()); } @@ -143,13 +155,15 @@ class SysIdRoutineLog { * * This is optional; SysId can perform an accurate fit without it. * + * The value is recorded in rotations/second^2 by default; + * to change this, specify your target unit as a generic bound. + * * @param acceleration The angular acceleration to record. - * @param U The unit of the recorded value; defaults to turns/second^2. * @return The motor log (for call chaining). */ template MotorLog& acceleration(units::turns_per_second_squared_t acceleration) { - U converted { acceleration }; + U converted{acceleration}; return value("acceleration", converted.value(), converted.name()); } @@ -158,13 +172,15 @@ class SysIdRoutineLog { * * This is optional; SysId can perform an accurate fit without it. * + * The value is recorded in amperes by default; + * to change this, specify your target unit as a generic bound. + * * @param current The current to record. - * @param U The unit of the recorded value; defaults to amperes. * @return The motor log (for call chaining). */ template MotorLog& current(units::ampere_t current) { - U converted { current }; + U converted{current}; return value("current", converted.value(), converted.name()); } From d024e56e2da5c72f6100ca6fcbc8decc89773165 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 6 Oct 2024 20:46:38 -0400 Subject: [PATCH 5/7] corrected import order --- .../java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java index 9de876e716c..def0939da4d 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java @@ -5,12 +5,12 @@ package edu.wpi.first.wpilibj.sysid; import edu.wpi.first.units.AngleUnit; -import edu.wpi.first.units.DistanceUnit; -import edu.wpi.first.units.AngularVelocityUnit; -import edu.wpi.first.units.LinearVelocityUnit; import edu.wpi.first.units.AngularAccelerationUnit; -import edu.wpi.first.units.LinearAccelerationUnit; +import edu.wpi.first.units.AngularVelocityUnit; import edu.wpi.first.units.CurrentUnit; +import edu.wpi.first.units.DistanceUnit; +import edu.wpi.first.units.LinearAccelerationUnit; +import edu.wpi.first.units.LinearVelocityUnit; import edu.wpi.first.units.VoltageUnit; import edu.wpi.first.units.measure.Angle; import edu.wpi.first.units.measure.AngularAcceleration; From 9b7d810e357a8288b35a4df28537912cbb41263f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 01:00:20 +0000 Subject: [PATCH 6/7] Formatting fixes --- .../edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java index def0939da4d..afdcfb94781 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java @@ -4,6 +4,8 @@ package edu.wpi.first.wpilibj.sysid; +import static edu.wpi.first.units.Units.*; + import edu.wpi.first.units.AngleUnit; import edu.wpi.first.units.AngularAccelerationUnit; import edu.wpi.first.units.AngularVelocityUnit; @@ -26,8 +28,6 @@ import java.util.HashMap; import java.util.Map; -import static edu.wpi.first.units.Units.*; - /** * Utility for logging data from a SysId test routine. Each complete routine (quasistatic and * dynamic, forward and reverse) should have its own SysIdRoutineLog instance, with a unique log @@ -239,9 +239,7 @@ public MotorLog linearAcceleration(LinearAcceleration acceleration) { * @return The motor log (for call chaining). */ public MotorLog linearAcceleration( - LinearAcceleration acceleration, - LinearAccelerationUnit unit - ) { + LinearAcceleration acceleration, LinearAccelerationUnit unit) { return value("acceleration", acceleration.in(unit), unit.name()); } @@ -267,9 +265,7 @@ public MotorLog angularAcceleration(AngularAcceleration acceleration) { * @return The motor log (for call chaining). */ public MotorLog angularAcceleration( - AngularAcceleration acceleration, - AngularAccelerationUnit unit - ) { + AngularAcceleration acceleration, AngularAccelerationUnit unit) { return value("acceleration", acceleration.in(unit), unit.name()); } From bf7ef650f0f0c88cd618dd10e87d593634c155c8 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 6 Oct 2024 22:14:52 -0400 Subject: [PATCH 7/7] Converted star project import to regular imports for java --- .../edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java index afdcfb94781..4fb5f648257 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/sysid/SysIdRoutineLog.java @@ -4,7 +4,14 @@ package edu.wpi.first.wpilibj.sysid; -import static edu.wpi.first.units.Units.*; +import static edu.wpi.first.units.Units.Amps; +import static edu.wpi.first.units.Units.Meters; +import static edu.wpi.first.units.Units.MetersPerSecond; +import static edu.wpi.first.units.Units.MetersPerSecondPerSecond; +import static edu.wpi.first.units.Units.Rotations; +import static edu.wpi.first.units.Units.RotationsPerSecond; +import static edu.wpi.first.units.Units.RotationsPerSecondPerSecond; +import static edu.wpi.first.units.Units.Volts; import edu.wpi.first.units.AngleUnit; import edu.wpi.first.units.AngularAccelerationUnit;