{
  "id": 340724,
  "title": "35th place: rtklib tweaking and factor graph approach",
  "url": "/competitions/smartphone-decimeter-2022/discussion/340724",
  "author_name": "Kuts Alexey",
  "post_date": "2022-07-30T16:47:05.158000",
  "votes": 10,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I tried two different approaches for this competition:</p>\n<ul>\n<li>rtklib based</li>\n<li>global optimization factor graph approach</li>\n</ul>\n<p><a href=\"https://github.com/krunt/gsdcchallenge2\" target=\"_blank\">source code</a>.</p>\n<h1>1. Rtklib tweaking</h1>\n<p>Based on 'Getting started with RTKLIB' notebook.<br>\nTried tweaking different configuration parameters. <br>\nHelped keeping cycle slip flags from receiver (slip_mask=3)<br>\nand adding weighting by snr and pseudorange uncertainty:<br>\nstats-errsnr: 0 -&gt; 0.003<br>\nstats-errrcv: 0 -&gt; 0.1<br>\nstats-errphaseel: 0.003 -&gt; 0<br>\nstats-errphase: 0.003 -&gt; 0</p>\n<p>Finally rtklib solution was postsmoothed by <a href=\"https://www.kaggle.com/code/taroz1461/carrier-smoothing-robust-wls-kalman-smoother\" target=\"_blank\">https://www.kaggle.com/code/taroz1461/carrier-smoothing-robust-wls-kalman-smoother</a> notebook.</p>\n<p>Tried ensembling between weighted by elevation and weighted by snr -&gt; worser results.<br>\nTried enabling ambiguity resolution- noisy data, false fixes -&gt; no improvement. <br>\nTried estimate velocity (estval() function) not by doppler but by TDCP technique (adr),<br>\nbut after debugging understood that velocity from doppler (results from estvel())<br>\nrarely (only in case of big pos variance) comes into ekf state, and velocity is got mostly from kalman state,<br>\ndid not much have time/success in modifying rtklib ekf model to adapt this.</p>\n<h1>2. Factor graph approach</h1>\n<p>Hope was that this is kind of global optimization model formulation (unlike ekf)<br>\nand it can potentially help.</p>\n<p>Adopted this code <a href=\"https://github.com/weisongwen/GraphGNSSLib\" target=\"_blank\">https://github.com/weisongwen/GraphGNSSLib</a>.</p>\n<p>This approach is using preprocessing via rtklib and afterwards solves <br>\noptimization problem via ceres solver.</p>\n<p>It did not much work out of the box for this dataset:<br>\nit relied on ambiguity resolution (but there were no fixes at all).</p>\n<p>Factors which finally were used:</p>\n<ul>\n<li>double difference pseudorange factor with reference station (analog to rtklib for code measurements, ddres() function)</li>\n<li>motion factor (distance between neigh epochs divided by dt - should be equal to est velocity)</li>\n<li>doppler factor for velocity estimation (it was used only if cycle slip was detected, otherwise adr factor was used),<br>\nestimation by doppler is close to estvel() function in rtklib</li>\n<li>adr factor for velocity estimation (TDCP technique, see paper: Time-differenced carrier phases technique for precise GNSS velocity estimation), plus of tdcp - is removal of integer ambiguity term. </li>\n</ul>\n<p>After testing with above factors I did get results severely affected by outliers,<br>\nso tried to remove outliers by switchable constraints/big initial residuals, got some kind of progress.</p>\n<p>Also the resulting trajectory was nonsmooth after all above factors so added kind of acceleration constraints<br>\nfor big acceleration. And also postprocessed solution with kalman smoother based on notebook listed above.</p>\n<h1>Submission</h1>\n<p>For submission I used weighted average of these two approaches.</p>",
  "messages": [
    {
      "id": 1877452,
      "postDate": "2022-07-30T16:47:05.157Z",
      "content": "<p>I tried two different approaches for this competition:</p>\n<ul>\n<li>rtklib based</li>\n<li>global optimization factor graph approach</li>\n</ul>\n<p><a href=\"https://github.com/krunt/gsdcchallenge2\" target=\"_blank\">source code</a>.</p>\n<h1>1. Rtklib tweaking</h1>\n<p>Based on 'Getting started with RTKLIB' notebook.<br>\nTried tweaking different configuration parameters. <br>\nHelped keeping cycle slip flags from receiver (slip_mask=3)<br>\nand adding weighting by snr and pseudorange uncertainty:<br>\nstats-errsnr: 0 -&gt; 0.003<br>\nstats-errrcv: 0 -&gt; 0.1<br>\nstats-errphaseel: 0.003 -&gt; 0<br>\nstats-errphase: 0.003 -&gt; 0</p>\n<p>Finally rtklib solution was postsmoothed by <a href=\"https://www.kaggle.com/code/taroz1461/carrier-smoothing-robust-wls-kalman-smoother\" target=\"_blank\">https://www.kaggle.com/code/taroz1461/carrier-smoothing-robust-wls-kalman-smoother</a> notebook.</p>\n<p>Tried ensembling between weighted by elevation and weighted by snr -&gt; worser results.<br>\nTried enabling ambiguity resolution- noisy data, false fixes -&gt; no improvement. <br>\nTried estimate velocity (estval() function) not by doppler but by TDCP technique (adr),<br>\nbut after debugging understood that velocity from doppler (results from estvel())<br>\nrarely (only in case of big pos variance) comes into ekf state, and velocity is got mostly from kalman state,<br>\ndid not much have time/success in modifying rtklib ekf model to adapt this.</p>\n<h1>2. Factor graph approach</h1>\n<p>Hope was that this is kind of global optimization model formulation (unlike ekf)<br>\nand it can potentially help.</p>\n<p>Adopted this code <a href=\"https://github.com/weisongwen/GraphGNSSLib\" target=\"_blank\">https://github.com/weisongwen/GraphGNSSLib</a>.</p>\n<p>This approach is using preprocessing via rtklib and afterwards solves <br>\noptimization problem via ceres solver.</p>\n<p>It did not much work out of the box for this dataset:<br>\nit relied on ambiguity resolution (but there were no fixes at all).</p>\n<p>Factors which finally were used:</p>\n<ul>\n<li>double difference pseudorange factor with reference station (analog to rtklib for code measurements, ddres() function)</li>\n<li>motion factor (distance between neigh epochs divided by dt - should be equal to est velocity)</li>\n<li>doppler factor for velocity estimation (it was used only if cycle slip was detected, otherwise adr factor was used),<br>\nestimation by doppler is close to estvel() function in rtklib</li>\n<li>adr factor for velocity estimation (TDCP technique, see paper: Time-differenced carrier phases technique for precise GNSS velocity estimation), plus of tdcp - is removal of integer ambiguity term. </li>\n</ul>\n<p>After testing with above factors I did get results severely affected by outliers,<br>\nso tried to remove outliers by switchable constraints/big initial residuals, got some kind of progress.</p>\n<p>Also the resulting trajectory was nonsmooth after all above factors so added kind of acceleration constraints<br>\nfor big acceleration. And also postprocessed solution with kalman smoother based on notebook listed above.</p>\n<h1>Submission</h1>\n<p>For submission I used weighted average of these two approaches.</p>",
      "rawMarkdown": "I tried two different approaches for this competition:\n- rtklib based\n- global optimization factor graph approach\n\n[source code](https://github.com/krunt/gsdcchallenge2).\n\n# 1. Rtklib tweaking\nBased on 'Getting started with RTKLIB' notebook.\nTried tweaking different configuration parameters. \nHelped keeping cycle slip flags from receiver (slip_mask=3)\nand adding weighting by snr and pseudorange uncertainty:\nstats-errsnr: 0 -> 0.003\nstats-errrcv: 0 -> 0.1\nstats-errphaseel: 0.003 -> 0\nstats-errphase: 0.003 -> 0\n\nFinally rtklib solution was postsmoothed by https://www.kaggle.com/code/taroz1461/carrier-smoothing-robust-wls-kalman-smoother notebook.\n\nTried ensembling between weighted by elevation and weighted by snr -> worser results.\nTried enabling ambiguity resolution- noisy data, false fixes -> no improvement. \nTried estimate velocity (estval() function) not by doppler but by TDCP technique (adr),\nbut after debugging understood that velocity from doppler (results from estvel())\nrarely (only in case of big pos variance) comes into ekf state, and velocity is got mostly from kalman state,\ndid not much have time/success in modifying rtklib ekf model to adapt this.\n\n# 2. Factor graph approach\n\nHope was that this is kind of global optimization model formulation (unlike ekf)\nand it can potentially help.\n\nAdopted this code [https://github.com/weisongwen/GraphGNSSLib](https://github.com/weisongwen/GraphGNSSLib).\n\nThis approach is using preprocessing via rtklib and afterwards solves \noptimization problem via ceres solver.\n\nIt did not much work out of the box for this dataset:\nit relied on ambiguity resolution (but there were no fixes at all).\n\nFactors which finally were used:\n- double difference pseudorange factor with reference station (analog to rtklib for code measurements, ddres() function)\n- motion factor (distance between neigh epochs divided by dt - should be equal to est velocity)\n- doppler factor for velocity estimation (it was used only if cycle slip was detected, otherwise adr factor was used),\n    estimation by doppler is close to estvel() function in rtklib\n- adr factor for velocity estimation (TDCP technique, see paper: Time-differenced carrier phases technique for precise GNSS velocity estimation), plus of tdcp - is removal of integer ambiguity term. \n\nAfter testing with above factors I did get results severely affected by outliers,\nso tried to remove outliers by switchable constraints/big initial residuals, got some kind of progress.\n  \nAlso the resulting trajectory was nonsmooth after all above factors so added kind of acceleration constraints\nfor big acceleration. And also postprocessed solution with kalman smoother based on notebook listed above.\n\n# Submission\nFor submission I used weighted average of these two approaches.",
      "votes": 9
    },
    {
      "id": 1877896,
      "postDate": "2022-07-31T04:23:57.247Z",
      "content": "<p>Thanks for sharing your approaches and code!<br>\nIn terms of getting this approach to work with the dataset, have you tried using a different solver?</p>",
      "rawMarkdown": "Thanks for sharing your approaches and code!\nIn terms of getting this approach to work with the dataset, have you tried using a different solver?\n",
      "replies": [
        {
          "id": 1878060,
          "postDate": "2022-07-31T07:01:38.893Z",
          "content": "<p>I knew about GTSAM, but didn't get time to test it.<br>\nCeres solver is very powerful and I believed that<br>\nthe main goal is good problem formulation and not optimizer tuning.</p>",
          "rawMarkdown": "I knew about GTSAM, but didn't get time to test it.\nCeres solver is very powerful and I believed that\nthe main goal is good problem formulation and not optimizer tuning."
        }
      ]
    },
    {
      "id": 1877501,
      "postDate": "2022-07-30T17:48:14.220Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1877896,
      "author_name": "The Devastator",
      "author_url": "",
      "post_date": "2022-07-31T04:23:57.247000",
      "content": "<p>Thanks for sharing your approaches and code!<br>\nIn terms of getting this approach to work with the dataset, have you tried using a different solver?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1878060,
          "author_name": "Kuts Alexey",
          "author_url": "",
          "post_date": "2022-07-31T07:01:38.893000",
          "content": "<p>I knew about GTSAM, but didn't get time to test it.<br>\nCeres solver is very powerful and I believed that<br>\nthe main goal is good problem formulation and not optimizer tuning.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1877501,
      "author_name": "",
      "author_url": "",
      "post_date": "2022-07-30T17:48:14.220000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1877452": "I tried two different approaches for this competition:\n- rtklib based\n- global optimization factor graph approach\n\n[source code](https://github.com/krunt/gsdcchallenge2).\n\n# 1. Rtklib tweaking\nBased on 'Getting started with RTKLIB' notebook.\nTried tweaking different configuration parameters. \nHelped keeping cycle slip flags from receiver (slip_mask=3)\nand adding weighting by snr and pseudorange uncertainty:\nstats-errsnr: 0 -> 0.003\nstats-errrcv: 0 -> 0.1\nstats-errphaseel: 0.003 -> 0\nstats-errphase: 0.003 -> 0\n\nFinally rtklib solution was postsmoothed by https://www.kaggle.com/code/taroz1461/carrier-smoothing-robust-wls-kalman-smoother notebook.\n\nTried ensembling between weighted by elevation and weighted by snr -> worser results.\nTried enabling ambiguity resolution- noisy data, false fixes -> no improvement. \nTried estimate velocity (estval() function) not by doppler but by TDCP technique (adr),\nbut after debugging understood that velocity from doppler (results from estvel())\nrarely (only in case of big pos variance) comes into ekf state, and velocity is got mostly from kalman state,\ndid not much have time/success in modifying rtklib ekf model to adapt this.\n\n# 2. Factor graph approach\n\nHope was that this is kind of global optimization model formulation (unlike ekf)\nand it can potentially help.\n\nAdopted this code [https://github.com/weisongwen/GraphGNSSLib](https://github.com/weisongwen/GraphGNSSLib).\n\nThis approach is using preprocessing via rtklib and afterwards solves \noptimization problem via ceres solver.\n\nIt did not much work out of the box for this dataset:\nit relied on ambiguity resolution (but there were no fixes at all).\n\nFactors which finally were used:\n- double difference pseudorange factor with reference station (analog to rtklib for code measurements, ddres() function)\n- motion factor (distance between neigh epochs divided by dt - should be equal to est velocity)\n- doppler factor for velocity estimation (it was used only if cycle slip was detected, otherwise adr factor was used),\n    estimation by doppler is close to estvel() function in rtklib\n- adr factor for velocity estimation (TDCP technique, see paper: Time-differenced carrier phases technique for precise GNSS velocity estimation), plus of tdcp - is removal of integer ambiguity term. \n\nAfter testing with above factors I did get results severely affected by outliers,\nso tried to remove outliers by switchable constraints/big initial residuals, got some kind of progress.\n  \nAlso the resulting trajectory was nonsmooth after all above factors so added kind of acceleration constraints\nfor big acceleration. And also postprocessed solution with kalman smoother based on notebook listed above.\n\n# Submission\nFor submission I used weighted average of these two approaches.",
    "1877896": "Thanks for sharing your approaches and code!\nIn terms of getting this approach to work with the dataset, have you tried using a different solver?\n",
    "1877501": ""
  }
}