Skip to content

Commit

Permalink
[wpilib] Fix SysId log key for acceleration (wpilibsuite#6196)
Browse files Browse the repository at this point in the history
Also add to docs that logging acceleration and current is optional.
  • Loading branch information
calcmogul authored Jan 11, 2024
1 parent 211c2a3 commit ba9c21c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions wpilibc/src/main/native/include/frc/sysid/SysIdRoutineLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class SysIdRoutineLog {
/**
* 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.
* @return The motor log (for call chaining).
*/
Expand All @@ -122,6 +124,8 @@ class SysIdRoutineLog {
/**
* 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.
* @return The motor log (for call chaining).
*/
Expand All @@ -132,6 +136,8 @@ class SysIdRoutineLog {
/**
* Log the current applied to the motor.
*
* This is optional; SysId can perform an accurate fit without it.
*
* @param current The current to record.
* @return The motor log (for call chaining).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,32 +163,38 @@ public MotorLog angularVelocity(Measure<Velocity<Angle>> velocity) {
/**
* Log the linear acceleration of the motor.
*
* <p>This is optional; SysId can perform an accurate fit without it.
*
* @param acceleration The linear acceleration to record.
* @return The motor log (for call chaining).
*/
public MotorLog linearAcceleration(Measure<Velocity<Velocity<Distance>>> acceleration) {
return value(
"position",
"acceleration",
acceleration.in(MetersPerSecond.per(Second)),
MetersPerSecond.per(Second).name());
}

/**
* Log the angular acceleration of the motor.
*
* <p>This is optional; SysId can perform an accurate fit without it.
*
* @param acceleration The angular acceleration to record.
* @return The motor log (for call chaining).
*/
public MotorLog angularAcceleration(Measure<Velocity<Velocity<Angle>>> acceleration) {
return value(
"position",
"acceleration",
acceleration.in(RotationsPerSecond.per(Second)),
RotationsPerSecond.per(Second).name());
}

/**
* Log the current applied to the motor.
*
* <p>This is optional; SysId can perform an accurate fit without it.
*
* @param current The current to record.
* @return The motor log (for call chaining).
*/
Expand Down

0 comments on commit ba9c21c

Please sign in to comment.