我已經爲Android安裝了GPS追蹤器。到目前爲止,它工作得相當不錯,但我在計算軌道的高度差時遇到問題。我想總結一下所有儀表的「爬升」和「下降」。我在後臺服務中執行此操作,將當前位置對象與前一個位置對象進行比較,並將差異直接作爲列存儲在數據庫中。如果我在軌道完成後對此進行總結,我會得到一個大約是使用氣壓計的自行車車速表測量值的2.5倍(1500米對650米)的值。GPS軌道,計算高度差
我知道GPS設備的測量高度不準確。有什麼辦法可以使測量的高度「正常化」嗎?例如,我是否應該忽略低於2米的所有高度變化?另一種可能性是使用附加的傳感器,因爲一些設備也具有氣壓計。但是這隻對某些設備有幫助。
感謝您對此問題的任何建議或提示!
編輯28.05.2013: 布萊斯的答案讓我走上了正軌。我開始搜索網絡,發現一個非常簡單的低通濾波器,易於實現。 我在C + +
表示一個路點的節點類這樣做:
class Node {
private:
double distance;
double altitude;
double altitudeup;
double altitudedown;
double latitude;
double longitude;
long timestamp;
public:
Node(double dist, double alti, double altiup, double altidown, double lat, double lon, long ts);
double getAltitude();
double getAltitudeup();
double getAltitudedown();
};
這裏是執行實際工作和計算值總上升和功能下降:
void SimpleLowPass::applySLP()
{
double altiUp = 0;
double altiDown = 0;
double prevAlti = this->nodeList[0]->getAltitude();
double newAlti = prevAlti;
for (auto n : this->nodeList)
{
double cur = n->getAltitude();
// All the power of the filter is in the line
// newAlti += (cur - newAlti)/smoothing.
// This finds the difference between the new value and the current (smoothed)
// value, shrinks it based on the strength of the filter, and then adds it
// to the smoothed value. You can see that if smoothing is set to 1 then the
// smoothed value always becomes the next value. If the smoothing is set to
// 2 then the smoothed value moves halfway to each new point on each new
// frame. The larger the smoothing value, the less the smoothed line is
// perturbed by new changes.
newAlti += (cur - newAlti)/20.0;
std::cout << "newAlti: " << newAlti << std::endl;
if (prevAlti > newAlti)
{
altiDown += prevAlti - newAlti;
}
if (newAlti > prevAlti)
{
altiUp += newAlti - prevAlti;
}
prevAlti = newAlti;
}
std::cout << "Alti UP total: " << altiUp << std::endl;
std::cout << "Alti DOWN total: " << altiDown << std::endl;
}
這是一個快速和骯髒的實現。但用平滑值爲20,我獲得了相當不錯的結果。我仍然需要記錄更多曲目並比較結果。此外,網站上還有幀率獨立實現,我發現這個低通濾波器,我想用移動平均實現。
感謝您的答案!
我會建議氣壓計比GPS精確得多。此外,你確定你的自行車高度表跟蹤所有提升/下降的總和,而不僅僅是起點和終點之間的高程差異嗎? – 323go
@ 323go晴雨表如果準確得多,但只適用於三角洲。 – Bryce
我用一個在線地圖服務創建的軌道檢查了deltas。上下有720米,所以我的自行車高度表的值應該相當不錯 –