MatthewPeterKelly / OptimTraj

A trajectory optimization library for Matlab
MIT License
616 stars 210 forks source link

Can this be used for time parameterization? #3

Closed davetcoleman closed 8 years ago

davetcoleman commented 8 years ago

I love the work you've done with both this project and Kinematic_Constrained_Trajectory. I was wondering if any of your work can solve the time parametrization problem? I ran your Matlab code and read through some of it, and it seems you always specify the time interval of your waypoints or max time allowed. Is this a constraint that must be pre-calculated? I'm trying to find a solution for this problem.

Thanks!

MatthewPeterKelly commented 8 years ago

Thanks! Your research looks pretty neat as well. Will you be at ICRA 2016?

I'm not sure that I totally understand your question, but I will do my best. Let me know if I've answered it, or if you were intending something else.

The Kinematic_Constrained_Trajectory project solves a very specific problem, and the time way-points must be specified ahead of time. This is done so that the resulting optimization problem is a quadratic program, which can practically be solved in real time.

This project (TrajOpt), handles a general single-phase continuous-time trajectory optimization problem. The initial and final time are both decision variables. I constrain both of them in most of my example problems, but this need not be the case. For example, you could set the initial time to be zero, and then allow the final time to be any time after the initial time. The optimization will scale the intermediate points accordingly. As of now TrajOpt requires a uniform mesh for it's direct collocation and shooting methods, but it would be a relatively easy change to allow the user to define an arbitrary grid between the initial and final times.

In theory, it is possible to let the time for every grid point be a decision variable. Unfortunately this will result in a badly behaved non-linear program. This I learned from personal experience, before I read it in Bett's book.

They way to get better locations for grid-points is by iteratively solving the trajectory optimization: start with a simple mesh (perhaps uniform, like I use in TrajOpt), and then do an error analysis on the solution to determine where to add grid points, and then solve again on a new grid. This is done automatically in GPOPS II and PSOPT. I would love to implement such a feature in TrajOpt, and have started laying some of the groundwork for doing so. It will probably be some time though before I get to it.

Let me know if this answered your question, or if any of the above does not make sense.

Matt

davetcoleman commented 8 years ago

Hi Matthew,

I do not believe I will be at ICRA this year, sadly. Thank you for this detailed response on how TrajOpt works. I ended up going with another library to solve my problem since it more directly solved the TOPP problem (Time-Optimal Path Parametrization) - I used the implementation from this paper: A General, Fast, and Robust Implementation of the Time-Optimal Path Parameterization Algorithm

Dave

MatthewPeterKelly commented 8 years ago

Dave,

That paper seems like a much better choice for your application. I had not heard of the TOPP problem before. I skimmed through the paper, and I think that such a problem might be able to be solved in TrajOpt, but certainly not as efficiently as their methods would be. Thanks for sharing!

Matt