{
  "id": 323964,
  "title": "Orientation data?",
  "url": "/competitions/smartphone-decimeter-2022/discussion/323964",
  "author_name": "Andrew",
  "post_date": "2022-05-09T14:18:15.961000",
  "votes": 4,
  "comment_count": 4,
  "views": 0,
  "content": "<p>The description of the data says that we should be able to find estimated orientation data (pitch/raw/roll) since March 2021.  However, I'm struggling to find any.  I've looked in the relevant file (<code>supplemental/gnss_log.txt</code>), for both train and test, pre- and post-March 2021.  The header of that file makes it look like it's going to contain the orientation estimates, but then none of the individual lines are marked as orientation lines.</p>\n<p>It feels like I'm doing something silly, but I can't see what. Have you found any pitch/yaw/roll data and, if so, can you give me an example of a file and line that contains it?</p>\n<blockquote>\n  <p><strong><code>[train/test]/[drive_id]/[phone_name]/supplemental/gnss_log.txt</code></strong> - The phone's logs as generated by the GnssLogger App. This notebook demonstrates how to parse the logs. Each gnss file contains several sub-datasets, each of which is detailed below:</p>\n  <p>[snip]</p>\n  <p>OrientationDeg - Each row represents an estimated device orientation, collected from Android API SensorManager#getOrientation. This message is only available in logs collected since March 2021.</p>\n  <ul>\n  <li><code>utcTimeMillis</code> - The sum of elapsedRealtimeNanos below and the estimated device boot time at UTC, after a recent NTP (Network Time Protocol) sync.</li>\n  <li><code>elapsedRealtimeNanos</code> - The time in nanoseconds at which the event happened.</li>\n  <li><code>yawDeg</code> - If the screen is in portrait mode, this value equals the Azimuth degree (modulus to 0°~360°). If the screen is in landscape mode, it equals the sum (modulus to 0°~360°) of the screen rotation angle (either 90° or 270°) and the Azimuth degree. Azimuth, refers to the angle of rotation about the -z axis. This value represents the angle between the device's y axis and the magnetic north pole.</li>\n  <li><code>rollDeg</code> - Roll, angle of rotation about the y axis. This value represents the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground.</li>\n  <li><code>pitchDeg</code> - Pitch, angle of rotation about the x axis. This value represents the angle between a plane parallel to the device's screen and a plane parallel to the ground.</li>\n  </ul>\n</blockquote>",
  "messages": [
    {
      "id": 1785901,
      "postDate": "2022-05-12T13:32:03.633Z",
      "content": "<p>There is unfortunately no orientation sensor data as this sensor type was deprecated in Android 4.4W (API level 20). In addition to <a href=\"https://www.kaggle.com/queyrusi\" target=\"_blank\">@queyrusi</a>'s implementation, Android has <a href=\"https://developer.android.com/guide/topics/sensors/sensors_position#sensors-pos-orient\" target=\"_blank\">guidance</a> on using accel and mag to compute the device's orientation, albeit via Android libraries.</p>",
      "rawMarkdown": "There is unfortunately no orientation sensor data as this sensor type was deprecated in Android 4.4W (API level 20). In addition to @queyrusi's implementation, Android has [guidance](https://developer.android.com/guide/topics/sensors/sensors_position#sensors-pos-orient) on using accel and mag to compute the device's orientation, albeit via Android libraries.",
      "votes": 6
    },
    {
      "id": 1782360,
      "postDate": "2022-05-09T14:18:15.960Z",
      "content": "<p>The description of the data says that we should be able to find estimated orientation data (pitch/raw/roll) since March 2021.  However, I'm struggling to find any.  I've looked in the relevant file (<code>supplemental/gnss_log.txt</code>), for both train and test, pre- and post-March 2021.  The header of that file makes it look like it's going to contain the orientation estimates, but then none of the individual lines are marked as orientation lines.</p>\n<p>It feels like I'm doing something silly, but I can't see what. Have you found any pitch/yaw/roll data and, if so, can you give me an example of a file and line that contains it?</p>\n<blockquote>\n  <p><strong><code>[train/test]/[drive_id]/[phone_name]/supplemental/gnss_log.txt</code></strong> - The phone's logs as generated by the GnssLogger App. This notebook demonstrates how to parse the logs. Each gnss file contains several sub-datasets, each of which is detailed below:</p>\n  <p>[snip]</p>\n  <p>OrientationDeg - Each row represents an estimated device orientation, collected from Android API SensorManager#getOrientation. This message is only available in logs collected since March 2021.</p>\n  <ul>\n  <li><code>utcTimeMillis</code> - The sum of elapsedRealtimeNanos below and the estimated device boot time at UTC, after a recent NTP (Network Time Protocol) sync.</li>\n  <li><code>elapsedRealtimeNanos</code> - The time in nanoseconds at which the event happened.</li>\n  <li><code>yawDeg</code> - If the screen is in portrait mode, this value equals the Azimuth degree (modulus to 0°~360°). If the screen is in landscape mode, it equals the sum (modulus to 0°~360°) of the screen rotation angle (either 90° or 270°) and the Azimuth degree. Azimuth, refers to the angle of rotation about the -z axis. This value represents the angle between the device's y axis and the magnetic north pole.</li>\n  <li><code>rollDeg</code> - Roll, angle of rotation about the y axis. This value represents the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground.</li>\n  <li><code>pitchDeg</code> - Pitch, angle of rotation about the x axis. This value represents the angle between a plane parallel to the device's screen and a plane parallel to the ground.</li>\n  </ul>\n</blockquote>",
      "rawMarkdown": "The description of the data says that we should be able to find estimated orientation data (pitch/raw/roll) since March 2021.  However, I'm struggling to find any.  I've looked in the relevant file (`supplemental/gnss_log.txt`), for both train and test, pre- and post-March 2021.  The header of that file makes it look like it's going to contain the orientation estimates, but then none of the individual lines are marked as orientation lines.\n\nIt feels like I'm doing something silly, but I can't see what. Have you found any pitch/yaw/roll data and, if so, can you give me an example of a file and line that contains it?\n\n> **`[train/test]/[drive_id]/[phone_name]/supplemental/gnss_log.txt`** - The phone's logs as generated by the GnssLogger App. This notebook demonstrates how to parse the logs. Each gnss file contains several sub-datasets, each of which is detailed below:\n>\n> \\[snip\\]\n>\n> OrientationDeg - Each row represents an estimated device orientation, collected from Android API SensorManager#getOrientation. This message is only available in logs collected since March 2021.\n>\n> - `utcTimeMillis` - The sum of elapsedRealtimeNanos below and the estimated device boot time at UTC, after a recent NTP (Network Time Protocol) sync.\n> - `elapsedRealtimeNanos` - The time in nanoseconds at which the event happened.\n> - `yawDeg` - If the screen is in portrait mode, this value equals the Azimuth degree (modulus to 0°~360°). If the screen is in landscape mode, it equals the sum (modulus to 0°~360°) of the screen rotation angle (either 90° or 270°) and the Azimuth degree. Azimuth, refers to the angle of rotation about the -z axis. This value represents the angle between the device's y axis and the magnetic north pole.\n> - `rollDeg` - Roll, angle of rotation about the y axis. This value represents the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground.\n> - `pitchDeg` - Pitch, angle of rotation about the x axis. This value represents the angle between a plane parallel to the device's screen and a plane parallel to the ground.",
      "votes": 4
    },
    {
      "id": 1784234,
      "postDate": "2022-05-11T03:42:23.163Z",
      "content": "<p>I was looking for these features as well but I couldn't find them anywhere despite going through several <code>supplemental</code> files. <br>\nUntil something is done I would recommend you check out <a href=\"https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu\" target=\"_blank\">my draft implementation</a> of an orientation filter that will provide you with axial angles.<br>\nBest of luck 😊!</p>",
      "rawMarkdown": "I was looking for these features as well but I couldn't find them anywhere despite going through several `supplemental` files. \nUntil something is done I would recommend you check out [my draft implementation](https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu) of an orientation filter that will provide you with axial angles.\nBest of luck 😊!",
      "votes": 2
    },
    {
      "id": 1828035,
      "postDate": "2022-06-21T13:01:38.407Z",
      "content": "<p><a href=\"https://www.kaggle.com/andrewrrose\" target=\"_blank\">@andrewrrose</a> <br>\n<a href=\"https://www.kaggle.com/brianjulian\" target=\"_blank\">@brianjulian</a> <br>\nHave you been able to calculate the orientation from the acc and mag as suggested by your host?<br>\nI tried to get the orientation from the following equation, but I am having trouble.</p>\n<p>$$ roll = \\arctan\\frac{acc_y}{acc_z} $$<br>\n$$ pitch = \\arctan\\frac{-acc_x}{sqrt(acc_y ^ 2 + acc_z^ 2)} $$</p>\n<p>$$ cr = cos(roll)\\qquad  sr = sin(roll)\\qquad cp = cos(pitch)\\qquad sp = sin(pitch) $$<br>\n$$ yaw = \\arctan\\frac{- cr * mag_y + sr * mag_z}{cp * mag_x + sp * sr * mag_y + sp * cr * mag_z} $$</p>\n<p>The yaw angle is not exact.<br>\nAny advice would be appreciated.</p>",
      "rawMarkdown": "@andrewrrose \n@brianjulian \nHave you been able to calculate the orientation from the acc and mag as suggested by your host?\nI tried to get the orientation from the following equation, but I am having trouble.\n\n$$ roll = \\arctan\\\\frac{acc_y}{acc_z} $$\n$$ pitch = \\arctan\\\\frac{-acc_x}{sqrt(acc_y ^ 2 + acc_z^ 2)} $$\n\n$$ cr = cos(roll)\\qquad  sr = sin(roll)\\qquad cp = cos(pitch)\\qquad sp = sin(pitch) $$\n$$ yaw = \\arctan\\\\frac{- cr * mag_y + sr * mag_z}{cp * mag_x + sp * sr * mag_y + sp * cr * mag_z} $$\n\nThe yaw angle is not exact.\nAny advice would be appreciated."
    },
    {
      "id": 1838325,
      "postDate": "2022-06-30T12:16:21.567Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1785901,
      "author_name": "Brian Julian",
      "author_url": "",
      "post_date": "2022-05-12T13:32:03.633000",
      "content": "<p>There is unfortunately no orientation sensor data as this sensor type was deprecated in Android 4.4W (API level 20). In addition to <a href=\"https://www.kaggle.com/queyrusi\" target=\"_blank\">@queyrusi</a>'s implementation, Android has <a href=\"https://developer.android.com/guide/topics/sensors/sensors_position#sensors-pos-orient\" target=\"_blank\">guidance</a> on using accel and mag to compute the device's orientation, albeit via Android libraries.</p>",
      "votes": 6,
      "replies": []
    },
    {
      "id": 1784234,
      "author_name": "queyrusi",
      "author_url": "",
      "post_date": "2022-05-11T03:42:23.163000",
      "content": "<p>I was looking for these features as well but I couldn't find them anywhere despite going through several <code>supplemental</code> files. <br>\nUntil something is done I would recommend you check out <a href=\"https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu\" target=\"_blank\">my draft implementation</a> of an orientation filter that will provide you with axial angles.<br>\nBest of luck 😊!</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1828035,
      "author_name": "yone-moto",
      "author_url": "",
      "post_date": "2022-06-21T13:01:38.407000",
      "content": "<p><a href=\"https://www.kaggle.com/andrewrrose\" target=\"_blank\">@andrewrrose</a> <br>\n<a href=\"https://www.kaggle.com/brianjulian\" target=\"_blank\">@brianjulian</a> <br>\nHave you been able to calculate the orientation from the acc and mag as suggested by your host?<br>\nI tried to get the orientation from the following equation, but I am having trouble.</p>\n<p>$$ roll = \\arctan\\frac{acc_y}{acc_z} $$<br>\n$$ pitch = \\arctan\\frac{-acc_x}{sqrt(acc_y ^ 2 + acc_z^ 2)} $$</p>\n<p>$$ cr = cos(roll)\\qquad  sr = sin(roll)\\qquad cp = cos(pitch)\\qquad sp = sin(pitch) $$<br>\n$$ yaw = \\arctan\\frac{- cr * mag_y + sr * mag_z}{cp * mag_x + sp * sr * mag_y + sp * cr * mag_z} $$</p>\n<p>The yaw angle is not exact.<br>\nAny advice would be appreciated.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1838325,
      "author_name": "",
      "author_url": "",
      "post_date": "2022-06-30T12:16:21.567000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1785901": "There is unfortunately no orientation sensor data as this sensor type was deprecated in Android 4.4W (API level 20). In addition to @queyrusi's implementation, Android has [guidance](https://developer.android.com/guide/topics/sensors/sensors_position#sensors-pos-orient) on using accel and mag to compute the device's orientation, albeit via Android libraries.",
    "1782360": "The description of the data says that we should be able to find estimated orientation data (pitch/raw/roll) since March 2021.  However, I'm struggling to find any.  I've looked in the relevant file (`supplemental/gnss_log.txt`), for both train and test, pre- and post-March 2021.  The header of that file makes it look like it's going to contain the orientation estimates, but then none of the individual lines are marked as orientation lines.\n\nIt feels like I'm doing something silly, but I can't see what. Have you found any pitch/yaw/roll data and, if so, can you give me an example of a file and line that contains it?\n\n> **`[train/test]/[drive_id]/[phone_name]/supplemental/gnss_log.txt`** - The phone's logs as generated by the GnssLogger App. This notebook demonstrates how to parse the logs. Each gnss file contains several sub-datasets, each of which is detailed below:\n>\n> \\[snip\\]\n>\n> OrientationDeg - Each row represents an estimated device orientation, collected from Android API SensorManager#getOrientation. This message is only available in logs collected since March 2021.\n>\n> - `utcTimeMillis` - The sum of elapsedRealtimeNanos below and the estimated device boot time at UTC, after a recent NTP (Network Time Protocol) sync.\n> - `elapsedRealtimeNanos` - The time in nanoseconds at which the event happened.\n> - `yawDeg` - If the screen is in portrait mode, this value equals the Azimuth degree (modulus to 0°~360°). If the screen is in landscape mode, it equals the sum (modulus to 0°~360°) of the screen rotation angle (either 90° or 270°) and the Azimuth degree. Azimuth, refers to the angle of rotation about the -z axis. This value represents the angle between the device's y axis and the magnetic north pole.\n> - `rollDeg` - Roll, angle of rotation about the y axis. This value represents the angle between a plane perpendicular to the device's screen and a plane perpendicular to the ground.\n> - `pitchDeg` - Pitch, angle of rotation about the x axis. This value represents the angle between a plane parallel to the device's screen and a plane parallel to the ground.",
    "1784234": "I was looking for these features as well but I couldn't find them anywhere despite going through several `supplemental` files. \nUntil something is done I would recommend you check out [my draft implementation](https://www.kaggle.com/code/queyrusi/orientation-filter-stop-prediction-with-imu) of an orientation filter that will provide you with axial angles.\nBest of luck 😊!",
    "1828035": "@andrewrrose \n@brianjulian \nHave you been able to calculate the orientation from the acc and mag as suggested by your host?\nI tried to get the orientation from the following equation, but I am having trouble.\n\n$$ roll = \\arctan\\\\frac{acc_y}{acc_z} $$\n$$ pitch = \\arctan\\\\frac{-acc_x}{sqrt(acc_y ^ 2 + acc_z^ 2)} $$\n\n$$ cr = cos(roll)\\qquad  sr = sin(roll)\\qquad cp = cos(pitch)\\qquad sp = sin(pitch) $$\n$$ yaw = \\arctan\\\\frac{- cr * mag_y + sr * mag_z}{cp * mag_x + sp * sr * mag_y + sp * cr * mag_z} $$\n\nThe yaw angle is not exact.\nAny advice would be appreciated.",
    "1838325": ""
  }
}