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