Use trajectory generic type in minimum-jerk problem when possible