calc_nav_yaw

So I've been trying to find a way to control the heading on takeoff and within the code there is the following section on the Attitude tab:

 

//  Yaw is separated into a function for future implementation of heading hold on take-off
// ----------------------------------------------------------------------------------------
void calc_nav_yaw(float speed_scaler)
{
    // read_adc(4) is y axis accel;
    // Control is a feedforward from the aileron control + a PID to coordinate the turn (drive y axis accel to zero)
    servo_out[CH_RUDDER] = kff[CASE_RUDDER_MIX] * servo_out[CH_ROLL] + PID((long)read_adc(4), deltaMiliSeconds, CASE_SERVO_RUDDER, speed_scaler);
}

 

My question is whether anyone has done the "future implementation" already. If not, how would I do this? Would the calculation be similar to that used in the calc_nav_pitch section (below) ?

 

void calc_nav_pitch()
{
    // Calculate the Pitch of the plane
    // --------------------------------
    nav_pitch = -PID(airspeed_error, dTnav, CASE_NAV_PITCH_ASP, 1.0);
    nav_pitch = constrain(nav_pitch, pitch_min, pitch_max);
}

 

 

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

Join diydrones

Email me when people reply –

Replies

  • Developer
    I believe this is implemented on the trunk, which is not currently in a flyable state.
This reply was deleted.

Activity