<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calculation of roll, pitch and yaw angles in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/968380#M5905</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an IMU&amp;nbsp;FXOS8700CQR1 which has an accelerometer and magnetometer. I'm trying to calculate roll, pitch from the accelerometer and&amp;nbsp;yaw from the magnetometer.&lt;/P&gt;&lt;P&gt;roll = atan2(-accelerometer[1],accelerometer[2]);&lt;/P&gt;&lt;P&gt;pitch = atan2(accelerometer[0],sqrt(accelerometer[1]*accelerometer[1]+(accelerometer[2]*accelerometer[2])));&lt;/P&gt;&lt;P&gt;magx = magnetometer[0]*cos(pitch)+magnetometer[1]*sin(roll)*sin(pitch) + magnetometer[2]*sin(pitch)*cos(roll);&lt;/P&gt;&lt;P&gt;magy = -magnetometer[1]*cos(roll) + magnetometer[2]*sin(roll);&lt;/P&gt;&lt;P&gt;yaw =&amp;nbsp; atan2(-magy,magx)*180/M_PI;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm getting incorrect yaw data but I'm not sure about the equations which I found on the internet. Does anybody have any idea in this regard?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Feb 2026 21:18:05 GMT</pubDate>
    <dc:creator>shrijan00</dc:creator>
    <dc:date>2026-02-03T21:18:05Z</dc:date>
    <item>
      <title>Calculation of roll, pitch and yaw angles</title>
      <link>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/968380#M5905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an IMU&amp;nbsp;FXOS8700CQR1 which has an accelerometer and magnetometer. I'm trying to calculate roll, pitch from the accelerometer and&amp;nbsp;yaw from the magnetometer.&lt;/P&gt;&lt;P&gt;roll = atan2(-accelerometer[1],accelerometer[2]);&lt;/P&gt;&lt;P&gt;pitch = atan2(accelerometer[0],sqrt(accelerometer[1]*accelerometer[1]+(accelerometer[2]*accelerometer[2])));&lt;/P&gt;&lt;P&gt;magx = magnetometer[0]*cos(pitch)+magnetometer[1]*sin(roll)*sin(pitch) + magnetometer[2]*sin(pitch)*cos(roll);&lt;/P&gt;&lt;P&gt;magy = -magnetometer[1]*cos(roll) + magnetometer[2]*sin(roll);&lt;/P&gt;&lt;P&gt;yaw =&amp;nbsp; atan2(-magy,magx)*180/M_PI;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm getting incorrect yaw data but I'm not sure about the equations which I found on the internet. Does anybody have any idea in this regard?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2026 21:18:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/968380#M5905</guid>
      <dc:creator>shrijan00</dc:creator>
      <dc:date>2026-02-03T21:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of roll, pitch and yaw angles</title>
      <link>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/968381#M5906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Equation 22 of the application note AN4248 may help you for this task: &lt;A href="https://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf"&gt;https://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if your system need the yaw, pitch and roll calculations, I would recommend you to use the FXAS21002 gyroscope sensor instead: &lt;A href="https://www.nxp.com/docs/en/data-sheet/FXAS21002.pdf"&gt;https://www.nxp.com/docs/en/data-sheet/FXAS21002.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jose&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2019 17:28:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/968381#M5906</guid>
      <dc:creator>reyes</dc:creator>
      <dc:date>2019-10-28T17:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of roll, pitch and yaw angles</title>
      <link>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/1197029#M6392</link>
      <description>&lt;P&gt;Um, how would you go about calculating the yaw angle with only a gyroscope. I have an MPU6050 6-axis accelerometer and gyroscope and I have been unsuccessfully trying to calculate yaw angle.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 02:29:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/1197029#M6392</guid>
      <dc:creator>JimmyXelectroN</dc:creator>
      <dc:date>2020-12-10T02:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of roll, pitch and yaw angles</title>
      <link>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/1682988#M7493</link>
      <description>I have an mpu6050 which has an accelerometer and gyroscop . I'm trying to calculate roll, pitch from the accelerometer and yaw from the sensor I'm getting incorrect yaw data please help to me</description>
      <pubDate>Thu, 06 Jul 2023 08:51:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/Calculation-of-roll-pitch-and-yaw-angles/m-p/1682988#M7493</guid>
      <dc:creator>Hari123pass123</dc:creator>
      <dc:date>2023-07-06T08:51:31Z</dc:date>
    </item>
  </channel>
</rss>

