From 83be80eea113871af71fac36d8b3fac737ffece4 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Sun, 25 May 2014 14:47:33 +0200 Subject: [PATCH] Fix missing bank and pitch interpolation The multiplikation with -1 should not be required. Needs to be checked. This is a workaround for the time being to correct pitch/bank. --- src/blackcore/interpolator_linear.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/blackcore/interpolator_linear.cpp b/src/blackcore/interpolator_linear.cpp index d1db3a768..12bc8e441 100644 --- a/src/blackcore/interpolator_linear.cpp +++ b/src/blackcore/interpolator_linear.cpp @@ -98,6 +98,28 @@ namespace BlackCore + headingBegin, headingBegin.getReferenceNorth())); + // Interpolate Pitch: Pitch = (PitchB - PitchA) * t + PitchA + CAngle pitchBegin = beginSituation.getPitch(); + CAngle pitchEnd = endSituation.getPitch(); + + CAngle pitch = (pitchEnd - pitchBegin) * simulationTime + pitchBegin; + + // TODO: According to the specification, pitch above horizon should be negative. + // But somehow we get positive pitches from the network. + pitch *= -1; + currentSituation.setPitch(pitch); + + // Interpolate bank: Bank = (BankB - BankA) * t + BankA + CAngle bankBegin = beginSituation.getBank(); + CAngle bankEnd = endSituation.getBank(); + + CAngle bank = (bankEnd - bankBegin) * simulationTime + bankBegin; + + // TODO: According to the specification, banks to the right should be negative. + // But somehow we get positive banks from the network. + bank *= -1; + currentSituation.setBank(bank); + currentSituation.setGroundspeed((endSituation.getGroundSpeed() - beginSituation.getGroundSpeed()) * simulationTime + beginSituation.getGroundSpeed());