3

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.

1 Answers1

2

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.

Russ Tedrake
  • 4,703
  • 1
  • 7
  • 10
  • Many thanks for your answer. As you have mentioned, it would be nice if this feature be a part of Pydrake in the future. I wanted to kindly ask your opinion on a problem we are facing for the trajectory tracking of the acrobot at some points in trajectory. We observed big spikes in those specific points, and do you think adding these higher-order constraints to the problem can resolve the issue? Or would it be helpful to fit fourth-order polynomial(or higher)to the state trajectory to get smooth acceleration/jerk polynomials? *Trajectory stabilization with TVLQR works fine in the simulation – Mahdi Javadi Jan 05 '22 at 19:17
  • I'll need more details to help. Big spikes in what? The derivatives of the state trajectory? The control input? And do you experience these in the middle of the trajectory, or at the ends (sometimes it's easy to get artifacts at the ends)? – Russ Tedrake Jan 08 '22 at 22:14
  • Thank you for your time and the reply. I addressed your questions in the following bullet points: 1- The big spikes in the derivatives of the state trajectory 2- We are experiencing this in the middle of the trajectory For your convenience, I have added plots with a vertical line in the plots, showing the time that we lose the position tracking of the elbow. If you wanted to see the high-quality version of the plots: https://www.svgviewer.dev/s/OFJWjIH4 Thank you for your attention. – Mahdi Javadi Jan 11 '22 at 16:04