OPT4SMART / crazychoir

Flying Swarms of Crazyflie Quadrotors in ROS 2
https://opt4smart.github.io/crazychoir/
GNU General Public License v3.0
37 stars 3 forks source link

A question about coordinate transformation in crazychoir/crazychoir/crazychoir/controller/flatness_position_ctrl.py #21

Closed buaaerxuyang closed 2 months ago

buaaerxuyang commented 2 months ago

Hello, sir! Your program is excellent and has helped me a lot! However, while reading the underlying control code, I found one part that is difficult to understand and illogical. In line 37 of the program, in the control function you wrote, you first convert the attitude quaternion into a rotation matrix, and then you multiply the rotation matrix from the left by the desired force vector. The purpose of this step is to obtain the desired force vector in the robot's coordinate system. However, the effect of left-multiplying the rotation matrix is to convert a vector from the robot's coordinate system to the world coordinate system, while it seems you are doing the opposite. I think the code in line 44 should be rewritten as: thrust = np.dot(np.dot(RR.transpose(),F_des),e_3) After I modified and recompiled the program, I found that the drone still operates normally (since the drone's attitude tends to remain stable, the impact is minimal. My understanding may be incorrect, and I hope you can reconsider this statement. Thank you for reading!

lorenzopichierri commented 2 months ago

Thank you for your interest in our toolbox!

We really appreciate your help, you are right and the formula should be modified. We've already committed the corrected version of the code.

Thank you again, and if you need further clarification, feel free to ask.

Best, Lorenzo