HKUST-Aerial-Robotics / Fast-Planner

A Robust and Efficient Trajectory Planner for Quadrotors
GNU General Public License v3.0
2.4k stars 665 forks source link

Gradient of end point cost may be wrong #114

Closed BIRL-xu closed 3 years ago

BIRL-xu commented 3 years ago

Hi, I'm learning the great project and found the gradient calculation about the end point cost: https://github.com/HKUST-Aerial-Robotics/Fast-Planner/blob/2ddd7793eecd573dbb5b47e2c985aa06606df3cf/fast_planner/bspline_opt/src/bspline_optimizer.cpp#L291-L309 The cost function is f=dq^2, dq = 1/6(q_3+4q_2+q_1), so the gradient should not be divided by 6. E.g., the gradient for q_1, df/dq_1=df/dq dq/dq_1=2 dq 1.

Is it right?

ZbyLGsc commented 3 years ago

The derivative has no problem. 1/6 is obtained when applying the chain rule.

BIRL-xu commented 3 years ago

@ZbyLGsc Yes, you are right! I'm sorry for the stupid question. Thank you for your reply.

BIRL-xu commented 3 years ago

E.g., the gradient for q_1, df/dq_1=df/dq dq/dq_1=2 dq * 1/6.