From fc37265da5e2de0d57f14e395f29f352cb9534b2 Mon Sep 17 00:00:00 2001 From: Prateek Machiraju Date: Thu, 2 Jun 2022 21:22:47 -0700 Subject: [PATCH] [wpimath] Add angle measurement convention to ArmFeedforward docs (NFC) (#4285) --- .../first/math/controller/ArmFeedforward.java | 24 +++++++++--- .../include/frc/controller/ArmFeedforward.h | 38 ++++++++++++++----- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java index 2991511237..83a60e31ce 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java @@ -46,7 +46,9 @@ public class ArmFeedforward { /** * Calculates the feedforward from the gains and setpoints. * - * @param positionRadians The position (angle) setpoint. + * @param positionRadians The position (angle) setpoint. This angle should be measured from the + * horizontal (i.e. if the provided angle is 0, the arm should be parallel with the floor). If + * your encoder does not follow this convention, an offset should be added. * @param velocityRadPerSec The velocity setpoint. * @param accelRadPerSecSquared The acceleration setpoint. * @return The computed feedforward. @@ -63,7 +65,9 @@ public class ArmFeedforward { * Calculates the feedforward from the gains and velocity setpoint (acceleration is assumed to be * zero). * - * @param positionRadians The position (angle) setpoint. + * @param positionRadians The position (angle) setpoint. This angle should be measured from the + * horizontal (i.e. if the provided angle is 0, the arm should be parallel with the floor). If + * your encoder does not follow this convention, an offset should be added. * @param velocity The velocity setpoint. * @return The computed feedforward. */ @@ -81,7 +85,9 @@ public class ArmFeedforward { * you a simultaneously-achievable velocity constraint. * * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm. + * @param angle The angle of the arm. This angle should be measured from the horizontal (i.e. if + * the provided angle is 0, the arm should be parallel with the floor). If your encoder does + * not follow this convention, an offset should be added. * @param acceleration The acceleration of the arm. * @return The maximum possible velocity at the given acceleration and angle. */ @@ -97,7 +103,9 @@ public class ArmFeedforward { * you a simultaneously-achievable velocity constraint. * * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm. + * @param angle The angle of the arm. This angle should be measured from the horizontal (i.e. if + * the provided angle is 0, the arm should be parallel with the floor). If your encoder does + * not follow this convention, an offset should be added. * @param acceleration The acceleration of the arm. * @return The minimum possible velocity at the given acceleration and angle. */ @@ -113,7 +121,9 @@ public class ArmFeedforward { * simultaneously-achievable acceleration constraint. * * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm. + * @param angle The angle of the arm. This angle should be measured from the horizontal (i.e. if + * the provided angle is 0, the arm should be parallel with the floor). If your encoder does + * not follow this convention, an offset should be added. * @param velocity The velocity of the arm. * @return The maximum possible acceleration at the given velocity. */ @@ -128,7 +138,9 @@ public class ArmFeedforward { * simultaneously-achievable acceleration constraint. * * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm. + * @param angle The angle of the arm. This angle should be measured from the horizontal (i.e. if + * the provided angle is 0, the arm should be parallel with the floor). If your encoder does + * not follow this convention, an offset should be added. * @param velocity The velocity of the arm. * @return The minimum possible acceleration at the given velocity. */ diff --git a/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h b/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h index 2741668132..5621803f22 100644 --- a/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h @@ -47,7 +47,11 @@ class WPILIB_DLLEXPORT ArmFeedforward { /** * Calculates the feedforward from the gains and setpoints. * - * @param angle The angle setpoint, in radians. + * @param angle The angle setpoint, in radians. This angle should be + * measured from the horizontal (i.e. if the provided + * angle is 0, the arm should be parallel to the floor). + * If your encoder does not follow this convention, an + * offset should be added. * @param velocity The velocity setpoint, in radians per second. * @param acceleration The acceleration setpoint, in radians per second². * @return The computed feedforward, in volts. @@ -70,8 +74,12 @@ class WPILIB_DLLEXPORT ArmFeedforward { * achievable - enter the acceleration constraint, and this will give you * a simultaneously-achievable velocity constraint. * - * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm + * @param maxVoltage The maximum voltage that can be supplied to the arm. + * @param angle The angle of the arm. This angle should be measured + * from the horizontal (i.e. if the provided angle is 0, + * the arm should be parallel to the floor). If your + * encoder does not follow this convention, an offset + * should be added. * @param acceleration The acceleration of the arm. * @return The maximum possible velocity at the given acceleration and angle. */ @@ -91,8 +99,12 @@ class WPILIB_DLLEXPORT ArmFeedforward { * achievable - enter the acceleration constraint, and this will give you * a simultaneously-achievable velocity constraint. * - * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm + * @param maxVoltage The maximum voltage that can be supplied to the arm. + * @param angle The angle of the arm. This angle should be measured + * from the horizontal (i.e. if the provided angle is 0, + * the arm should be parallel to the floor). If your + * encoder does not follow this convention, an offset + * should be added. * @param acceleration The acceleration of the arm. * @return The minimum possible velocity at the given acceleration and angle. */ @@ -113,8 +125,12 @@ class WPILIB_DLLEXPORT ArmFeedforward { * a simultaneously-achievable acceleration constraint. * * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm - * @param velocity The velocity of the arm. + * @param angle The angle of the arm. This angle should be measured + * from the horizontal (i.e. if the provided angle is 0, + * the arm should be parallel to the floor). If your + * encoder does not follow this convention, an offset + * should be added. + * @param velocity The velocity of the arm. * @return The maximum possible acceleration at the given velocity and angle. */ units::unit_t MaxAchievableAcceleration( @@ -133,8 +149,12 @@ class WPILIB_DLLEXPORT ArmFeedforward { * a simultaneously-achievable acceleration constraint. * * @param maxVoltage The maximum voltage that can be supplied to the arm. - * @param angle The angle of the arm - * @param velocity The velocity of the arm. + * @param angle The angle of the arm. This angle should be measured + * from the horizontal (i.e. if the provided angle is 0, + * the arm should be parallel to the floor). If your + * encoder does not follow this convention, an offset + * should be added. + * @param velocity The velocity of the arm. * @return The minimum possible acceleration at the given velocity and angle. */ units::unit_t MinAchievableAcceleration(