# ArduCopter attitude controller ef to bf conversion

I am very new to ArduCopter and am trying to understand how the attitude control works. As a starting point, I am using ArduCopter 3.3 since it uses Euler angles instead of quaternions. I am confused about converting ef angle errors to desired bf angular rates. The following is in relation to angle_ef_roll_pitch_yaw method.

My thought was that I would first compute ef angle errors, multiply those by respective proportional gains to get desired ef angular rates. Then I would transform the desired ef angular rates to desired body frame angular rates. However, going through the angle_ef_roll_pitch_yaw method, it seems that first ef angle errors are computed and those are then transformed into body frame. And then the corresponding proportional gains are applied to get desired bf angular rates. I do not understand that part.

I thought one can convert ef angular rates into bf angular rates, but as mentioned above the code applies the coordinate transformation to the ef angle errors and not angular rates. We know that multiplying by proportional gains before the transformation is not the same as multiplying after the transformation.

I would greatly appreciate any input in this regard! That will help clear up my confusion. Thanks!

Take a look at:

and

there are lots of information about the control loops.

And if you want to implement your own controller take a look at:

1 Like

@amilcarlucas Thank you so much for your reply! I will go through the links you have provided, and hopefully I will understand all the details.