large_scale_traj_optimizer icon indicating copy to clipboard operation
large_scale_traj_optimizer copied to clipboard

Get Jerk at time t for a Piece of a Trajectory

Open MasonJohnHawver42 opened this issue 1 year ago • 0 comments

Is this how you would find the jerk at time t for a piece of a trajectory?

// Get the jerk at time t in this piece
inline Eigen::Vector3d getJerk(double t)
{
    // Normalize the time
    t /= duration;
    Eigen::Vector3d jerk(0.0, 0.0, 0.0);
    double tn = 1.0;
    int l = 1;
    int m = 2;
    int n = 3;
    for (int i = TrajOrder - 3; i >= 0; i--)
    {
        jerk += l * m * n * tn * normalizedCoeffMat().col(i);
        tn *= t;
        l++;
        m++;
        n++;
    }
    // Recover the actual jerk
    jerk /= (duration * duration * duration);
    return jerk;
}

This is for min snap but it could be applied to min jerk too. If this seems correct to you I'll happily send a pull request.

MasonJohnHawver42 avatar Apr 17 '24 02:04 MasonJohnHawver42