ZJU-FAST-Lab / GCOPTER

A General-Purpose Trajectory Optimizer for Multicopters
MIT License
684 stars 139 forks source link

forward and backward of T and P in gcopter.hpp #7

Closed Joeyyuenjoyslife closed 2 years ago

Joeyyuenjoyslife commented 2 years ago

Hi, Zhepei, thanks for your excellent work. A little question about the elimination of the constraints. it seems that the backward and forward of T and P (in gcopter.hpp) are not the same as described in the paper. I understand that the way it is implemented can also do the elimination of the constraints. Or am I just wrong and the implementation in the code is actually exactly the same as in the paper?

ZhepeiWang commented 2 years ago

Yes you are right.

For T, As is also given in the paper, we do not have to use exp as a smooth diffeo between R+ and R. In this code, we use the first 2 term in Taylor series of exp(x) and exp(-x) as a twice continuously differentiable diffeo between R+ and R, which is more efficient and numerically stable than exp itself.

For P, the only difference lies in the stereographic transform is originally used, while the code uses normalization x/||x|| to map a R^(n+1) on to an n-Sphere. In this code, this map is cascaded with the barycentric transform described in the paper. This is because the employed optimization alg theoretically requires the cost function has bounded sub-level set, which is easy to be satisfied in the normalization map. Technically, bounded sub-level set is just added for completeness.

Of course, there are some features released but not described in the paper, and also some features described in the paper but not ready to be released (busy...).

If you have some issues about the code, please feel free to let me know.

ZhepeiWang commented 2 years ago

By the way,

For T, constraint elimination is to extend the definition of decision vars to R.

For P, cons elim is a cheaper way to strictly enforce the spatial constraint as grad projection do, and preserve the high order info. The spatial constraints on P must be enforced because we do not wish distance between waypoints can infiniely approaches zero, that causes singularity.

Thus it is somewhat flexibility in handling them.

Joeyyuenjoyslife commented 2 years ago

Thank you so much for your patient and detailed response, it answered my question and helped me a lot. For now, i think i can close this issue. Thank you again for your inspiring work!