MCPcopy Create free account
hub / github.com/comaps/comaps / ExtrapolatedLocationUpdate

Method ExtrapolatedLocationUpdate

libs/map/extrapolation/extrapolator.cpp:148–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148void Extrapolator::ExtrapolatedLocationUpdate(uint64_t locationUpdateCounter)
149{
150 location::GpsInfo gpsInfo;
151 {
152 lock_guard<mutex> guard(m_mutex);
153 // Canceling all calls of the method which were activated before |m_locationUpdateMinValid|.
154 if (locationUpdateCounter < m_locationUpdateMinValid)
155 return;
156
157 uint64_t const extrapolationTimeMs = kExtrapolationPeriodMs * m_consecutiveRuns;
158 if (extrapolationTimeMs < kMaxExtrapolationTimeMs && m_lastGpsInfo.IsValid())
159 {
160 if (DoesExtrapolationWork())
161 gpsInfo = LinearExtrapolation(m_beforeLastGpsInfo, m_lastGpsInfo, extrapolationTimeMs);
162 else
163 gpsInfo = m_lastGpsInfo;
164 }
165 }
166
167 if (gpsInfo.IsValid())
168 GetPlatform().RunTask(Platform::Thread::Gui, [this, gpsInfo]() { m_extrapolatedLocationUpdate(gpsInfo); });
169
170 {
171 lock_guard<mutex> guard(m_mutex);
172 if (m_consecutiveRuns != kExtrapolationCounterUndefined)
173 ++m_consecutiveRuns;
174 }
175
176 // Calling ExtrapolatedLocationUpdate() in |kExtrapolationPeriodMs| milliseconds.
177 RunTaskOnBackgroundThread(true /* delayed */);
178}
179
180void Extrapolator::RunTaskOnBackgroundThread(bool delayed)
181{

Callers

nothing calls this directly

Calls 3

LinearExtrapolationFunction · 0.85
RunTaskMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected