mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #896 Renaming members.
This commit is contained in:
@@ -131,8 +131,8 @@ namespace BlackMisc
|
||||
{
|
||||
// HINT: VTOL aircraft can change pitch/bank without changing position, planes cannot
|
||||
// Interpolate heading: HDG = (HdgB - HdgA) * t + HdgA
|
||||
const CHeading headingBegin = oldSituation.getHeading();
|
||||
CHeading headingEnd = newSituation.getHeading();
|
||||
const CHeading headingBegin = m_oldSituation.getHeading();
|
||||
CHeading headingEnd = m_newSituation.getHeading();
|
||||
|
||||
if ((headingEnd - headingBegin).value(CAngleUnit::deg()) < -180)
|
||||
{
|
||||
@@ -145,7 +145,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
return CHeading((headingEnd - headingBegin)
|
||||
* simulationTimeFraction
|
||||
* m_simulationTimeFraction
|
||||
+ headingBegin,
|
||||
headingBegin.getReferenceNorth());
|
||||
}
|
||||
@@ -153,26 +153,26 @@ namespace BlackMisc
|
||||
CAngle CInterpolatorPbh::getPitch() const
|
||||
{
|
||||
// Interpolate Pitch: Pitch = (PitchB - PitchA) * t + PitchA
|
||||
const CAngle pitchBegin = oldSituation.getPitch();
|
||||
const CAngle pitchEnd = newSituation.getPitch();
|
||||
const CAngle pitch = (pitchEnd - pitchBegin) * simulationTimeFraction + pitchBegin;
|
||||
const CAngle pitchBegin = m_oldSituation.getPitch();
|
||||
const CAngle pitchEnd = m_newSituation.getPitch();
|
||||
const CAngle pitch = (pitchEnd - pitchBegin) * m_simulationTimeFraction + pitchBegin;
|
||||
return pitch;
|
||||
}
|
||||
|
||||
CAngle CInterpolatorPbh::getBank() const
|
||||
{
|
||||
// Interpolate bank: Bank = (BankB - BankA) * t + BankA
|
||||
const CAngle bankBegin = oldSituation.getBank();
|
||||
const CAngle bankEnd = newSituation.getBank();
|
||||
const CAngle bank = (bankEnd - bankBegin) * simulationTimeFraction + bankBegin;
|
||||
const CAngle bankBegin = m_oldSituation.getBank();
|
||||
const CAngle bankEnd = m_newSituation.getBank();
|
||||
const CAngle bank = (bankEnd - bankBegin) * m_simulationTimeFraction + bankBegin;
|
||||
return bank;
|
||||
}
|
||||
|
||||
CSpeed CInterpolatorPbh::getGroundSpeed() const
|
||||
{
|
||||
return (newSituation.getGroundSpeed() - oldSituation.getGroundSpeed())
|
||||
* simulationTimeFraction
|
||||
+ oldSituation.getGroundSpeed();
|
||||
return (m_newSituation.getGroundSpeed() - m_oldSituation.getGroundSpeed())
|
||||
* m_simulationTimeFraction
|
||||
+ m_oldSituation.getGroundSpeed();
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
|
||||
@@ -110,10 +110,10 @@ namespace BlackMisc
|
||||
CInterpolatorPbh()
|
||||
{}
|
||||
CInterpolatorPbh(const Aviation::CAircraftSituation &older, const Aviation::CAircraftSituation &newer) :
|
||||
oldSituation(older), newSituation(newer)
|
||||
m_oldSituation(older), m_newSituation(newer)
|
||||
{}
|
||||
CInterpolatorPbh(double time, const Aviation::CAircraftSituation &older, const Aviation::CAircraftSituation &newer) :
|
||||
simulationTimeFraction(time), oldSituation(older), newSituation(newer)
|
||||
m_simulationTimeFraction(time), m_oldSituation(older), m_newSituation(newer)
|
||||
{}
|
||||
//! @}
|
||||
|
||||
@@ -123,17 +123,17 @@ namespace BlackMisc
|
||||
PhysicalQuantities::CAngle getPitch() const;
|
||||
PhysicalQuantities::CAngle getBank() const;
|
||||
PhysicalQuantities::CSpeed getGroundSpeed() const;
|
||||
Aviation::CAircraftSituation getOldSituation() const { return oldSituation; }
|
||||
Aviation::CAircraftSituation getNewSituation() const { return newSituation; }
|
||||
Aviation::CAircraftSituation getOldSituation() const { return m_oldSituation; }
|
||||
Aviation::CAircraftSituation getNewSituation() const { return m_newSituation; }
|
||||
//! @}
|
||||
|
||||
//! Change time fraction
|
||||
void setTimeFraction(double tf) { simulationTimeFraction = tf; }
|
||||
void setTimeFraction(double tf) { m_simulationTimeFraction = tf; }
|
||||
|
||||
private:
|
||||
double simulationTimeFraction = 0.0;
|
||||
Aviation::CAircraftSituation oldSituation;
|
||||
Aviation::CAircraftSituation newSituation;
|
||||
double m_simulationTimeFraction = 0.0;
|
||||
Aviation::CAircraftSituation m_oldSituation;
|
||||
Aviation::CAircraftSituation m_newSituation;
|
||||
};
|
||||
|
||||
//! Status of interpolation
|
||||
|
||||
@@ -127,14 +127,14 @@ namespace BlackMisc
|
||||
Q_UNUSED(setup);
|
||||
Q_UNUSED(hints);
|
||||
|
||||
const std::array<double, 3> oldVec(oldSituation.getPosition().normalVectorDouble());
|
||||
const std::array<double, 3> newVec(newSituation.getPosition().normalVectorDouble());
|
||||
const std::array<double, 3> oldVec(m_oldSituation.getPosition().normalVectorDouble());
|
||||
const std::array<double, 3> newVec(m_newSituation.getPosition().normalVectorDouble());
|
||||
|
||||
// Interpolate position: pos = (posB - posA) * t + posA
|
||||
CCoordinateGeodetic currentPosition;
|
||||
currentPosition.setNormalVector((newVec[0] - oldVec[0]) * simulationTimeFraction + oldVec[0],
|
||||
(newVec[1] - oldVec[1]) * simulationTimeFraction + oldVec[1],
|
||||
(newVec[2] - oldVec[2]) * simulationTimeFraction + oldVec[2]);
|
||||
currentPosition.setNormalVector((newVec[0] - oldVec[0]) * m_simulationTimeFraction + oldVec[0],
|
||||
(newVec[1] - oldVec[1]) * m_simulationTimeFraction + oldVec[1],
|
||||
(newVec[2] - oldVec[2]) * m_simulationTimeFraction + oldVec[2]);
|
||||
return currentPosition;
|
||||
}
|
||||
|
||||
@@ -145,11 +145,11 @@ namespace BlackMisc
|
||||
|
||||
// Interpolate altitude: Alt = (AltB - AltA) * t + AltA
|
||||
// avoid underflow below ground elevation by using getCorrectedAltitude
|
||||
const CAltitude oldAlt(oldSituation.getCorrectedAltitude());
|
||||
const CAltitude newAlt(newSituation.getCorrectedAltitude());
|
||||
const CAltitude oldAlt(m_oldSituation.getCorrectedAltitude());
|
||||
const CAltitude newAlt(m_newSituation.getCorrectedAltitude());
|
||||
Q_ASSERT_X(oldAlt.getReferenceDatum() == CAltitude::MeanSeaLevel && oldAlt.getReferenceDatum() == newAlt.getReferenceDatum(), Q_FUNC_INFO, "mismatch in reference"); // otherwise no calculation is possible
|
||||
return CAltitude((newAlt - oldAlt)
|
||||
* simulationTimeFraction
|
||||
* m_simulationTimeFraction
|
||||
+ oldAlt,
|
||||
oldAlt.getReferenceDatum());
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace BlackMisc
|
||||
//! Constructor
|
||||
//! @{
|
||||
Interpolant(const Aviation::CAircraftSituation &situation) :
|
||||
situationsAvailable(1), oldSituation(situation) {}
|
||||
m_situationsAvailable(1), m_oldSituation(situation) {}
|
||||
Interpolant(const Aviation::CAircraftSituation &situation1, const Aviation::CAircraftSituation &situation2, double time) :
|
||||
situationsAvailable(2), oldSituation(situation1), newSituation(situation2), simulationTimeFraction(time) {}
|
||||
m_situationsAvailable(2), m_oldSituation(situation1), m_newSituation(situation2), m_simulationTimeFraction(time) {}
|
||||
//! @}
|
||||
|
||||
//! Perform the interpolation
|
||||
@@ -56,13 +56,13 @@ namespace BlackMisc
|
||||
//! @}
|
||||
|
||||
//! Interpolator for pitch, bank, heading, groundspeed
|
||||
CInterpolatorPbh pbh() const { return { simulationTimeFraction, oldSituation, newSituation }; }
|
||||
CInterpolatorPbh pbh() const { return { m_simulationTimeFraction, m_oldSituation, m_newSituation }; }
|
||||
|
||||
private:
|
||||
int situationsAvailable = 0;
|
||||
Aviation::CAircraftSituation oldSituation;
|
||||
Aviation::CAircraftSituation newSituation;
|
||||
double simulationTimeFraction = 0.0;
|
||||
int m_situationsAvailable = 0;
|
||||
Aviation::CAircraftSituation m_oldSituation;
|
||||
Aviation::CAircraftSituation m_newSituation;
|
||||
double m_simulationTimeFraction = 0.0;
|
||||
};
|
||||
|
||||
//! Get the interpolant for the given time point
|
||||
|
||||
@@ -126,14 +126,14 @@ namespace BlackMisc
|
||||
m_prevSampleTime = situationsOlder.begin()->getAdjustedMSecsSinceEpoch();
|
||||
m_nextSampleTime = (situationsNewer.end() - 1)->getAdjustedMSecsSinceEpoch();
|
||||
m_altitudeUnit = situationsOlder.begin()->getAltitude().getUnit();
|
||||
pbh = { *situationsOlder.begin(), *(situationsNewer.end() - 1) };
|
||||
m_pbh = { *situationsOlder.begin(), *(situationsNewer.end() - 1) };
|
||||
}
|
||||
log.oldSituation = pbh.getOldSituation();
|
||||
log.newSituation = pbh.getNewSituation();
|
||||
log.oldSituation = m_pbh.getOldSituation();
|
||||
log.newSituation = m_pbh.getNewSituation();
|
||||
|
||||
status.setInterpolationSucceeded(true);
|
||||
status.setChangedPosition(true);
|
||||
pbh.setTimeFraction(static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime) / static_cast<double>(m_nextSampleTime - m_prevSampleTime));
|
||||
m_pbh.setTimeFraction(static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime) / static_cast<double>(m_nextSampleTime - m_prevSampleTime));
|
||||
|
||||
return { *this, currentTimeMsSinceEpoc };
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ namespace BlackMisc
|
||||
//! @}
|
||||
|
||||
//! Interpolator for pitch, bank, heading, groundspeed
|
||||
CInterpolatorPbh pbh() const { return i.pbh; }
|
||||
CInterpolatorPbh pbh() const { return i.m_pbh; }
|
||||
|
||||
private:
|
||||
const CInterpolatorSpline &i;
|
||||
qint64 currentTimeMsSinceEpoc = 0;
|
||||
const CInterpolatorSpline &i;
|
||||
qint64 currentTimeMsSinceEpoc = 0;
|
||||
};
|
||||
|
||||
//! Strategy used by CInterpolator::getInterpolatedSituation
|
||||
@@ -67,7 +67,7 @@ namespace BlackMisc
|
||||
qint64 m_nextSampleTime = 0;
|
||||
PhysicalQuantities::CLengthUnit m_altitudeUnit;
|
||||
std::array<double, 3> x, y, z, a, t, dx, dy, dz, da;
|
||||
CInterpolatorPbh pbh;
|
||||
CInterpolatorPbh m_pbh;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user