{
  "id": 328229,
  "title": "Kalman filter for IMU and GNSS",
  "url": "/competitions/smartphone-decimeter-2022/discussion/328229",
  "author_name": "",
  "post_date": "2022-05-31T13:35:29.129105800Z",
  "votes": 6,
  "comment_count": 6,
  "views": 0,
  "content": "<p>I am trying to perform self-location estimation using a linear Kalman filter based on <a href=\"https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu\" target=\"_blank\">this notebook</a> and <a href=\"https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna\" target=\"_blank\">this notebook</a>.<br>\nFirst, I defined the observation equation H as (x,y,z,v_x,v_y,v_z,acc_x,acc_y,acc_z) and applied the Kalman filter as follows. However, it did not work well because the units of GNSS[°] and IMU[m/ss] are different.</p>\n<pre><code>H1 = np.array([[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0]\n　　　　　　, [0, 0, 1, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n</code></pre>\n<p>I am now trying to apply the Kalman filter by improving the observation equation H as follows, using the velocity obtained from GNSS as [m/s].</p>\n<pre><code>H2 = np.array([[0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 1, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n</code></pre>\n<p>And also need to calibrate imu.</p>\n<p>However, I am wondering if it is possible to apply the Kalman filter without changing the observation equation H1. I am also wondering if it is possible to use the extended Kalman filter in the future.</p>\n<p>I am still not getting better results than <a href=\"https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna\" target=\"_blank\">this notebook</a>, so I would appreciate any advice you can give me.</p>\n<p>Thank you very much.</p>",
  "messages": [
    {
      "id": "1806825",
      "postDate": "05/31/2022 13:35:29",
      "content": "<p>I am trying to perform self-location estimation using a linear Kalman filter based on <a href=\"https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu\" target=\"_blank\">this notebook</a> and <a href=\"https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna\" target=\"_blank\">this notebook</a>.<br>\nFirst, I defined the observation equation H as (x,y,z,v_x,v_y,v_z,acc_x,acc_y,acc_z) and applied the Kalman filter as follows. However, it did not work well because the units of GNSS[°] and IMU[m/ss] are different.</p>\n<pre><code>H1 = np.array([[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0]\n　　　　　　, [0, 0, 1, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n</code></pre>\n<p>I am now trying to apply the Kalman filter by improving the observation equation H as follows, using the velocity obtained from GNSS as [m/s].</p>\n<pre><code>H2 = np.array([[0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 1, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n</code></pre>\n<p>And also need to calibrate imu.</p>\n<p>However, I am wondering if it is possible to apply the Kalman filter without changing the observation equation H1. I am also wondering if it is possible to use the extended Kalman filter in the future.</p>\n<p>I am still not getting better results than <a href=\"https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna\" target=\"_blank\">this notebook</a>, so I would appreciate any advice you can give me.</p>\n<p>Thank you very much.</p>",
      "rawMarkdown": "I am trying to perform self-location estimation using a linear Kalman filter based on [this notebook](https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu) and [this notebook](https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna).\nFirst, I defined the observation equation H as (x,y,z,v_x,v_y,v_z,acc_x,acc_y,acc_z) and applied the Kalman filter as follows. However, it did not work well because the units of GNSS[°] and IMU[m/ss] are different.\n```\nH1 = np.array([[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0]\n　　　　　　, [0, 0, 1, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n```\nI am now trying to apply the Kalman filter by improving the observation equation H as follows, using the velocity obtained from GNSS as [m/s].\n```\nH2 = np.array([[0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 1, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n```\nAnd also need to calibrate imu.\n\n\nHowever, I am wondering if it is possible to apply the Kalman filter without changing the observation equation H1. I am also wondering if it is possible to use the extended Kalman filter in the future.\n\nI am still not getting better results than [this notebook](https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna), so I would appreciate any advice you can give me.\n\nThank you very much.",
      "votes": null
    },
    {
      "id": "1806897",
      "postDate": "05/31/2022 14:43:46",
      "content": "<p>The post above used the state quantity as latitude, longitude, and altitude. However, now considering the possibility of using ECEF as the state quantity instead of latitude, longitude, and altitude.</p>",
      "rawMarkdown": "The post above used the state quantity as latitude, longitude, and altitude. However, now considering the possibility of using ECEF as the state quantity instead of latitude, longitude, and altitude.",
      "votes": null
    },
    {
      "id": "1808653",
      "postDate": "06/02/2022 04:27:40",
      "content": "<p>The calibration for MI8 has been done in BOCHKATI M, PANY T. Does the Android Operating System Provide what the MEMS-IMU Manufacturers Promise?, F 2021]. IEEE.</p>",
      "rawMarkdown": "The calibration for MI8 has been done in BOCHKATI M, PANY T. Does the Android Operating System Provide what the MEMS-IMU Manufacturers Promise?, F 2021]. IEEE.",
      "votes": null
    },
    {
      "id": "1824121",
      "postDate": "06/18/2022 01:58:54",
      "content": "<p>Sorry to miss the main point of your question.</p>\n<p>The extended Kalman filter takes the derivative near the observation point, while the GSDC has velocity instead of derivative. If you include the velocity in the prediction step, I think a linear Kalman filter is fine.</p>",
      "rawMarkdown": "Sorry to miss the main point of your question.\n\nThe extended Kalman filter takes the derivative near the observation point, while the GSDC has velocity instead of derivative. If you include the velocity in the prediction step, I think a linear Kalman filter is fine.",
      "votes": null
    },
    {
      "id": "1827675",
      "postDate": "06/21/2022 08:10:13",
      "content": "<p>Thanks for the reply.<br>\nMy explanation was quite insufficient.</p>\n<p>You are right, the extended Kalman filter does the differentiation. Therefore, I think there is little difference between it and the Kalman filter.</p>\n<p>However, I am trying to apply the Kalman filter to the following equation of state, which is easier to handle when considering integration with imu.</p>\n<pre><code>x = x + v * cos(yaw_imu)\ny = y + v * sin(yaw_imu)\n</code></pre>\n<p>I am thinking of observing yaw angle from imu and position from gnss and updating the observation step.<br>\n(I am still trying to figure out the difference between this and the above method, which is to do a prediction step with the yaw angle from the imu and update the observation step with the gnss.)</p>\n<p>As you can see in the following post,<br>\n<a href=\"https://www.kaggle.com/competitions/smartphone-decimeter-2022/discussion/323964\" target=\"_blank\">https://www.kaggle.com/competitions/smartphone-decimeter-2022/discussion/323964</a><br>\n I need to calculate the Euler angle myself, but I am struggling to calculate the Euler angle from the imu (acceleration, angular velocity, magnetic).<br>\nIf you know anything about this, I would appreciate your advice.</p>",
      "rawMarkdown": "Thanks for the reply.\nMy explanation was quite insufficient.\n\nYou are right, the extended Kalman filter does the differentiation. Therefore, I think there is little difference between it and the Kalman filter.\n\nHowever, I am trying to apply the Kalman filter to the following equation of state, which is easier to handle when considering integration with imu.\n```\n\nx = x + v * cos(yaw_imu)\ny = y + v * sin(yaw_imu)\n```\n\nI am thinking of observing yaw angle from imu and position from gnss and updating the observation step.\n(I am still trying to figure out the difference between this and the above method, which is to do a prediction step with the yaw angle from the imu and update the observation step with the gnss.)\n\nAs you can see in the following post,\nhttps://www.kaggle.com/competitions/smartphone-decimeter-2022/discussion/323964\n I need to calculate the Euler angle myself, but I am struggling to calculate the Euler angle from the imu (acceleration, angular velocity, magnetic).\nIf you know anything about this, I would appreciate your advice.",
      "votes": null
    },
    {
      "id": "1833442",
      "postDate": "06/26/2022 02:42:27",
      "content": "<p>I understand what you are saying, the use of yaw angle is non-linear.<br>\nUnfortunately I am a layman in imu. I can't give you any advice.</p>",
      "rawMarkdown": "I understand what you are saying, the use of yaw angle is non-linear.\nUnfortunately I am a layman in imu. I can't give you any advice.",
      "votes": null
    },
    {
      "id": "1852882",
      "postDate": "07/12/2022 13:14:27",
      "content": "<p>got some help</p>",
      "rawMarkdown": "got some help",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1806897,
      "author_name": "tyonemoto",
      "author_url": "",
      "post_date": "05/31/2022 14:43:46",
      "content": "<p>The post above used the state quantity as latitude, longitude, and altitude. However, now considering the possibility of using ECEF as the state quantity instead of latitude, longitude, and altitude.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1808653,
      "author_name": "hyisoecn",
      "author_url": "",
      "post_date": "06/02/2022 04:27:40",
      "content": "<p>The calibration for MI8 has been done in BOCHKATI M, PANY T. Does the Android Operating System Provide what the MEMS-IMU Manufacturers Promise?, F 2021]. IEEE.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1824121,
      "author_name": "minfuka",
      "author_url": "",
      "post_date": "06/18/2022 01:58:54",
      "content": "<p>Sorry to miss the main point of your question.</p>\n<p>The extended Kalman filter takes the derivative near the observation point, while the GSDC has velocity instead of derivative. If you include the velocity in the prediction step, I think a linear Kalman filter is fine.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1827675,
          "author_name": "tyonemoto",
          "author_url": "",
          "post_date": "06/21/2022 08:10:13",
          "content": "<p>Thanks for the reply.<br>\nMy explanation was quite insufficient.</p>\n<p>You are right, the extended Kalman filter does the differentiation. Therefore, I think there is little difference between it and the Kalman filter.</p>\n<p>However, I am trying to apply the Kalman filter to the following equation of state, which is easier to handle when considering integration with imu.</p>\n<pre><code>x = x + v * cos(yaw_imu)\ny = y + v * sin(yaw_imu)\n</code></pre>\n<p>I am thinking of observing yaw angle from imu and position from gnss and updating the observation step.<br>\n(I am still trying to figure out the difference between this and the above method, which is to do a prediction step with the yaw angle from the imu and update the observation step with the gnss.)</p>\n<p>As you can see in the following post,<br>\n<a href=\"https://www.kaggle.com/competitions/smartphone-decimeter-2022/discussion/323964\" target=\"_blank\">https://www.kaggle.com/competitions/smartphone-decimeter-2022/discussion/323964</a><br>\n I need to calculate the Euler angle myself, but I am struggling to calculate the Euler angle from the imu (acceleration, angular velocity, magnetic).<br>\nIf you know anything about this, I would appreciate your advice.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1833442,
          "author_name": "minfuka",
          "author_url": "",
          "post_date": "06/26/2022 02:42:27",
          "content": "<p>I understand what you are saying, the use of yaw angle is non-linear.<br>\nUnfortunately I am a layman in imu. I can't give you any advice.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1852882,
      "author_name": "yisteve",
      "author_url": "",
      "post_date": "07/12/2022 13:14:27",
      "content": "<p>got some help</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1806825": "I am trying to perform self-location estimation using a linear Kalman filter based on [this notebook](https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu) and [this notebook](https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna).\nFirst, I defined the observation equation H as (x,y,z,v_x,v_y,v_z,acc_x,acc_y,acc_z) and applied the Kalman filter as follows. However, it did not work well because the units of GNSS[°] and IMU[m/ss] are different.\n```\nH1 = np.array([[1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0]\n　　　　　　, [0, 0, 1, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n```\nI am now trying to apply the Kalman filter by improving the observation equation H as follows, using the velocity obtained from GNSS as [m/s].\n```\nH2 = np.array([[0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 1, 0, 0, 0],[0, 0, 0, 0, 0, 0, 1, 0, 0]\n　　　　　　, [0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1]\n             　　　])    \n```\nAnd also need to calibrate imu.\n\n\nHowever, I am wondering if it is possible to apply the Kalman filter without changing the observation equation H1. I am also wondering if it is possible to use the extended Kalman filter in the future.\n\nI am still not getting better results than [this notebook](https://www.kaggle.com/code/dienhoa/where-is-my-phone-kalman-filter-optuna), so I would appreciate any advice you can give me.\n\nThank you very much.",
    "1806897": "The post above used the state quantity as latitude, longitude, and altitude. However, now considering the possibility of using ECEF as the state quantity instead of latitude, longitude, and altitude.",
    "1808653": "The calibration for MI8 has been done in BOCHKATI M, PANY T. Does the Android Operating System Provide what the MEMS-IMU Manufacturers Promise?, F 2021]. IEEE.",
    "1824121": "Sorry to miss the main point of your question.\n\nThe extended Kalman filter takes the derivative near the observation point, while the GSDC has velocity instead of derivative. If you include the velocity in the prediction step, I think a linear Kalman filter is fine.",
    "1827675": "Thanks for the reply.\nMy explanation was quite insufficient.\n\nYou are right, the extended Kalman filter does the differentiation. Therefore, I think there is little difference between it and the Kalman filter.\n\nHowever, I am trying to apply the Kalman filter to the following equation of state, which is easier to handle when considering integration with imu.\n```\n\nx = x + v * cos(yaw_imu)\ny = y + v * sin(yaw_imu)\n```\n\nI am thinking of observing yaw angle from imu and position from gnss and updating the observation step.\n(I am still trying to figure out the difference between this and the above method, which is to do a prediction step with the yaw angle from the imu and update the observation step with the gnss.)\n\nAs you can see in the following post,\nhttps://www.kaggle.com/competitions/smartphone-decimeter-2022/discussion/323964\n I need to calculate the Euler angle myself, but I am struggling to calculate the Euler angle from the imu (acceleration, angular velocity, magnetic).\nIf you know anything about this, I would appreciate your advice.",
    "1833442": "I understand what you are saying, the use of yaw angle is non-linear.\nUnfortunately I am a layman in imu. I can't give you any advice.",
    "1852882": "got some help"
  },
  "source": "meta"
}