[wpimath] Clean up profile classes (#6311)

* Reorder functions so they match between languages
* Copy more complete JavaDocs to C++
* Fix incorrect description for time parameter of
  TrapezoidProfile.calculate()
This commit is contained in:
Tyler Veness
2024-01-25 22:22:42 -08:00
committed by GitHub
parent d895a0c09f
commit 68736d802d
5 changed files with 162 additions and 90 deletions

View File

@@ -81,7 +81,7 @@ public class ExponentialProfile {
public final double B;
/**
* Construct constraints for an ExponentialProfile.
* Constructs constraints for an ExponentialProfile.
*
* @param maxInput maximum unsigned input voltage
* @param A The State-Space 1x1 system matrix.
@@ -103,7 +103,7 @@ public class ExponentialProfile {
}
/**
* Construct constraints for an ExponentialProfile from characteristics.
* Constructs constraints for an ExponentialProfile from characteristics.
*
* @param maxInput maximum unsigned input voltage
* @param kV The velocity gain.
@@ -115,7 +115,7 @@ public class ExponentialProfile {
}
/**
* Construct constraints for an ExponentialProfile from State-Space parameters.
* Constructs constraints for an ExponentialProfile from State-Space parameters.
*
* @param maxInput maximum unsigned input voltage
* @param A The State-Space 1x1 system matrix.
@@ -139,7 +139,7 @@ public class ExponentialProfile {
public State() {}
/**
* Construct a state within an exponential profile.
* Constructs a state within an exponential profile.
*
* @param position The position at this state.
* @param velocity The velocity at this state.
@@ -166,7 +166,7 @@ public class ExponentialProfile {
}
/**
* Construct an ExponentialProfile.
* Constructs an ExponentialProfile.
*
* @param constraints The constraints on the profile, like maximum input.
*/
@@ -175,10 +175,10 @@ public class ExponentialProfile {
}
/**
* Calculate the correct position and velocity for the profile at a time t where the current state
* is at time t = 0.
* Calculates the position and velocity for the profile at a time t where the current state is at
* time t = 0.
*
* @param t The time since the beginning of the profile.
* @param t How long to advance from the current state toward the desired state.
* @param current The current state.
* @param goal The desired state when the profile is complete.
* @return The position and velocity of the profile at time t.
@@ -205,7 +205,7 @@ public class ExponentialProfile {
}
/**
* Calculate the point after which the fastest way to reach the goal state is to apply input in
* Calculates the point after which the fastest way to reach the goal state is to apply input in
* the opposite direction.
*
* @param current The current state.
@@ -220,7 +220,7 @@ public class ExponentialProfile {
}
/**
* Calculate the point after which the fastest way to reach the goal state is to apply input in
* Calculates the point after which the fastest way to reach the goal state is to apply input in
* the opposite direction.
*
* @param current The current state.
@@ -242,7 +242,7 @@ public class ExponentialProfile {
}
/**
* Calculate the time it will take for this profile to reach the goal state.
* Calculates the time it will take for this profile to reach the goal state.
*
* @param current The current state.
* @param goal The desired state when the profile is complete.
@@ -255,8 +255,8 @@ public class ExponentialProfile {
}
/**
* Calculate the time it will take for this profile to reach the inflection point, and the time it
* will take for this profile to reach the goal state.
* Calculates the time it will take for this profile to reach the inflection point, and the time
* it will take for this profile to reach the goal state.
*
* @param current The current state.
* @param goal The desired state when the profile is complete.
@@ -271,8 +271,8 @@ public class ExponentialProfile {
}
/**
* Calculate the time it will take for this profile to reach the inflection point, and the time it
* will take for this profile to reach the goal state.
* Calculates the time it will take for this profile to reach the inflection point, and the time
* it will take for this profile to reach the goal state.
*
* @param current The current state.
* @param inflectionPoint The inflection point of this profile.
@@ -332,7 +332,7 @@ public class ExponentialProfile {
}
/**
* Calculate the position reached after t seconds when applying an input from the initial state.
* Calculates the position reached after t seconds when applying an input from the initial state.
*
* @param t The time since the initial state.
* @param input The signed input applied to this profile from the initial state.
@@ -349,7 +349,7 @@ public class ExponentialProfile {
}
/**
* Calculate the velocity reached after t seconds when applying an input from the initial state.
* Calculates the velocity reached after t seconds when applying an input from the initial state.
*
* @param t The time since the initial state.
* @param input The signed input applied to this profile from the initial state.
@@ -365,7 +365,7 @@ public class ExponentialProfile {
}
/**
* Calculate the time required to reach a specified velocity given the initial velocity.
* Calculates the time required to reach a specified velocity given the initial velocity.
*
* @param velocity The goal velocity.
* @param input The signed input applied to this profile from the initial state.
@@ -381,7 +381,7 @@ public class ExponentialProfile {
}
/**
* Calculate the distance reached at the same time as the given velocity when applying the given
* Calculates the distance reached at the same time as the given velocity when applying the given
* input from the initial state.
*
* @param velocity The velocity reached by this profile
@@ -400,7 +400,7 @@ public class ExponentialProfile {
}
/**
* Calculate the velocity at which input should be reversed in order to reach the goal state from
* Calculates the velocity at which input should be reversed in order to reach the goal state from
* the current state.
*
* @param input The signed input applied to this profile from the current state.

View File

@@ -63,7 +63,7 @@ public class TrapezoidProfile {
public final double maxAcceleration;
/**
* Construct constraints for a TrapezoidProfile.
* Constructs constraints for a TrapezoidProfile.
*
* @param maxVelocity maximum velocity
* @param maxAcceleration maximum acceleration
@@ -75,7 +75,7 @@ public class TrapezoidProfile {
}
/**
* Construct constraints for a TrapezoidProfile.
* Constructs constraints for a TrapezoidProfile.
*
* @param <U> Unit type.
* @param maxVelocity maximum velocity
@@ -137,7 +137,7 @@ public class TrapezoidProfile {
}
/**
* Construct a TrapezoidProfile.
* Constructs a TrapezoidProfile.
*
* @param constraints The constraints on the profile, like maximum velocity.
*/
@@ -147,7 +147,7 @@ public class TrapezoidProfile {
}
/**
* Construct a TrapezoidProfile.
* Constructs a TrapezoidProfile.
*
* @param constraints The constraints on the profile, like maximum velocity.
* @param goal The desired state when the profile is complete.
@@ -197,7 +197,7 @@ public class TrapezoidProfile {
}
/**
* Construct a TrapezoidProfile.
* Constructs a TrapezoidProfile.
*
* @param constraints The constraints on the profile, like maximum velocity.
* @param goal The desired state when the profile is complete.
@@ -210,10 +210,10 @@ public class TrapezoidProfile {
}
/**
* Calculate the correct position and velocity for the profile at a time t where the beginning of
* the profile was at time t = 0.
* Calculates the position and velocity for the profile at a time t where the current state is at
* time t = 0.
*
* @param t The time since the beginning of the profile.
* @param t How long to advance from the current state toward the desired state.
* @return The position and velocity of the profile at time t.
* @deprecated Pass the desired and current state into calculate instead of constructing a new
* TrapezoidProfile with the desired and current state
@@ -247,10 +247,10 @@ public class TrapezoidProfile {
}
/**
* Calculate the correct position and velocity for the profile at a time t where the beginning of
* the profile was at time t = 0.
* Calculates the position and velocity for the profile at a time t where the current state is at
* time t = 0.
*
* @param t The time since the beginning of the profile.
* @param t How long to advance from the current state toward the desired state.
* @param current The current state.
* @param goal The desired state when the profile is complete.
* @return The position and velocity of the profile at time t.