Testing Ardupilot 2.5 from Jason Short on Vimeo.
Comment by Rana on February 13, 2010 at 7:10pm 



float calc_nav_roll(float error)
{
static float err_rate_limiter = 0;
integrators[I_NAV_ROLL] += (error * head_I * deltaMiliSeconds)/1000.0;
// Limit Integrator
// ----------------
integrators[I_NAV_ROLL] = constrain(integrators[I_NAV_ROLL], HEAD_I_MIN, HEAD_I_MAX);
// Sum the errors
// --------------
error = (head_P * error) + integrators[I_NAV_ROLL];
// rate of change dampener
if(error > err_rate_limiter){
err_rate_limiter += 70;
}else{
err_rate_limiter -= 70;
}
err_rate_limiter = constrain(err_rate_limiter, HEAD_MIN, HEAD_MAX);
return (err_rate_limiter);
}

float calc_nav_roll(float error)
{
static float old_error = 0;
integrators[I_NAV_ROLL] += (error * head_I * deltaMiliSeconds)/1000.0;
// Limit Integrator
// ----------------
integrators[I_NAV_ROLL] = constrain(integrators[I_NAV_ROLL], HEAD_I_MIN, HEAD_I_MAX);
// Sum the errors
// --------------
error = (head_P * error) + integrators[I_NAV_ROLL];
error = constrain(error, HEAD_MIN, HEAD_MAX);
old_error = old_error *.9 + error *.1;
return (old_error);
}

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.1285 members
677 members
24 members
4 members
8 members
© 2013 Created by Chris Anderson.
Powered by

You need to be a member of DIY Drones to add comments!
Join DIY Drones