Understanding Arducopter code

Hello

 

I have been trying to understand the Arducopter code, but i have some doubts that don't seem to go away -

 

Question 1 -

 

In File "Attitude.pde" (Version - v1.0, Aug 27, 2010) in function Rate_control_v2 on line 141, I see -

currentRollRate = ToDeg(Omega[0]);

should this not be -

currentRollRate = ToDeg(Omega_Vector[0]);

Isn't Omega_Vector the fully corrected Gyro reading? And if it is, should that not be used to get current roll rate rather than use Omega (which has only got integral correction)?

 

Question 2 -

 

In File "Attitude.pde" (Version - v1.0, Aug 27, 2010) in function Attitude_control_v3 on line 75 we have -

err_roll = stable_roll - ToDeg(Omega[0]); // Omega[] is the raw gyro reading plus Omega_I, so it´s bias corrected
control_roll = STABLE_MODE_KP_RATE_ROLL*err_roll;

 

Why are we subtracting Omgea from stable_roll? stable_roll already seems to have gain1*error+gain2*integral(error).

 

Question 3 -

 

I do not understand the use of the following variables - Arming_counter, Disarming_counter, motorArmed, motorSafety, Safety_counter.

 

Thanks in advance,

Srinath

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • After reading Mahony's paper, "Nonlinear complementary filters on the special orthogonal group", i fully agree with the expression given in File "Attitude.pde" (Version - v1.0, Aug 27, 2010) in function Rate_control_v2 on line 141
    The equation used to estimate the gyro bias is eqn no 32b in the paper. And following the Lyapunov proof in the paper, it appears that we only need the term which is an integral of the error and don't need the proportional term at all.
  • 3.

    Arming_counter and Disarming_counter are used as a timer for the arming and disarming process (so you have to hold arming for a certain amount of time)

     

    motorArmed says if the motors are armed or not (if they are activated, it's a safety system)

     

    motorSafety and Safety_counter are used for motor safety system (if your throttle is low and you increase it very fast, your motors will disarm)

     

    sorry, can't help you on 1. and 2.

This reply was deleted.

Activity