ethz-asl / mav_trajectory_generation

Polynomial trajectory generation and optimization, especially for rotary-wing MAVs.
Apache License 2.0
528 stars 222 forks source link

Adding orientation constraints #83

Closed jbourne15 closed 5 years ago

jbourne15 commented 5 years ago

Can someone help me understand adding constraints for ORIENTATION.

I have specified 3 vertexes, in which the middle one has a position and orientation constrain. I am confused about how to specify to actual constraint. I have tried

middle.addConstraint(mav_trajectory_generation::derivative_order::POSITION, Eigen::Vector3d(2,2,2)); middle.addConstraint(mav_trajectory_generation::derivative_order::ORIENTATION, Eigen::Vector3d(R,P,Y));

Also, the dimension of the trajectory is 3, so do I need trajectories in RPY for this constrain to work?

helenol commented 5 years ago

If you want to do XYZ Yaw, you need to specify 4 dimensions and be careful about angle wrapping. This underlying library has no understanding of angles vs. positions; it just assumes scalars. For MAVs specifying R and P makes no sense as they are a function of instantaneous acceleration; only yaw is decoupled. I can try to dig up some sample code for you, but as reference we usually plan position-space trajectory first then plan yaw separately and append the trajectories as they're completely independent.

jbourne15 commented 5 years ago

Thanks for the reply, this makes sense.