mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpimath] Clean up math comments (#4252)
This commit is contained in:
@@ -62,7 +62,7 @@ Trajectory TrajectoryParameterizer::TimeParameterizeTrajectory(
|
||||
// acceleration, since acceleration limits may be a function of velocity.
|
||||
while (true) {
|
||||
// Enforce global max velocity and max reachable velocity by global
|
||||
// acceleration limit. vf = std::sqrt(vi^2 + 2*a*d).
|
||||
// acceleration limit. v_f = √(v_i² + 2ad).
|
||||
|
||||
constrainedState.maxVelocity = units::math::min(
|
||||
maxVelocity,
|
||||
@@ -126,7 +126,7 @@ Trajectory TrajectoryParameterizer::TimeParameterizeTrajectory(
|
||||
|
||||
while (true) {
|
||||
// Enforce max velocity limit (reverse)
|
||||
// vf = std::sqrt(vi^2 + 2*a*d), where vi = successor.
|
||||
// v_f = √(v_i² + 2ad), where v_i = successor.
|
||||
units::meters_per_second_t newMaxVelocity =
|
||||
units::math::sqrt(successor.maxVelocity * successor.maxVelocity +
|
||||
successor.minAcceleration * ds * 2.0);
|
||||
@@ -187,10 +187,10 @@ Trajectory TrajectoryParameterizer::TimeParameterizeTrajectory(
|
||||
if (i > 0) {
|
||||
states.at(i - 1).acceleration = reversed ? -accel : accel;
|
||||
if (units::math::abs(accel) > 1E-6_mps_sq) {
|
||||
// v_f = v_0 + a * t
|
||||
// v_f = v_0 + at
|
||||
dt = (state.maxVelocity - v) / accel;
|
||||
} else if (units::math::abs(v) > 1E-6_mps) {
|
||||
// delta_x = v * t
|
||||
// delta_x = vt
|
||||
dt = ds / v;
|
||||
} else {
|
||||
throw std::runtime_error(fmt::format(
|
||||
|
||||
Reference in New Issue
Block a user