- Joined
- Mar 28, 2008
- Messages
- 666
- Reaction score
- 20
- Points
- 33
I've got this method in my code to get the reqired vertical acceleration for landing for my baseland autopilot, but I can't remember what k1 and k2 are...?
Are this values good? The code is working well, but I'm not sure how i came to this values and this formular... :-(
I hope it's possible to understand the code...
"interceptAlt" is the minimum altitude between ship and ground.
Getting "HorizontalSpeed" looks like this:
v->GetHorizonAirspeedVector(horizonAirspeedVector)
HorizontalSpeed = sqrt((horizonAirspeedVector.x*horizonAirspeedVector.x) + (horizonAirspeedVector.z * horizonAirspeedVector.z))
Are this values good? The code is working well, but I'm not sure how i came to this values and this formular... :-(
I hope it's possible to understand the code...
"interceptAlt" is the minimum altitude between ship and ground.
Getting "HorizontalSpeed" looks like this:
v->GetHorizonAirspeedVector(horizonAirspeedVector)
HorizontalSpeed = sqrt((horizonAirspeedVector.x*horizonAirspeedVector.x) + (horizonAirspeedVector.z * horizonAirspeedVector.z))
Code:
double autopilot::getRequiredVerticalAcceleration(double interceptAlt) //VERTICAL ACCELERATION PROGRAMM
{
double t = (distanceToMaxElevation * 2) / (HorizontalSpeed); // Time to the point with maximum elevation angle
double k1 = 0.75;
double k2 = -8;
double dh = v->GetAltitude(AltitudeMode::ALTMODE_MEANRAD) - maxElevation; //Current delta between altitude and maximum elevation
return k2 * (k1 * t * horizonAirspeedVector.y - interceptAlt + dh) / (t*t);
}
Last edited: