I would like to know if there is an elegant way to impose acceleration/jerk level constraint on the trajectory optimization using the DirectCollocation class. I am working with an Acrobot system, and I have already included the velocity level constraint, but I wanted to have a minimum/smooth jerk optimal trajectory. Thank you in advance.
Yes. The standard direct collocation method (which is implemented in the DirectCollocation class) uses cubic splines to represent the position trajectory. If you take the second derivative, you'll be left with a first-order spline... so the acceleration is always piecewise-linear, and the jerk is always piecewise constant.
So the constraints that you would add would be simple constraints on the spline coefficients of the state trajectory. We don't offer those constraints directly in the API (but could). You could implement them (are you in python or c++) following the pattern here.
It might also help to look at the corresponding section of the course notes if you haven't.
One subtlety -- the current implementation actually represents the state trajectory as the cubic spline (it redundantly represents the positions and velocities). You could opt to add your constraints to either the position trajectory or the velocity trajectory. The constraints should be satisfied perfectly at the knots/collocation points, but the trajectories will be subtly different due to the interpolation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With