How to calculate a rotation matrix from Euler angles, specifically in pitch-yaw-roll format?

22 Views Asked by At

So, I'm working on an app and a big part of that is tracking traversed distance using an accelerometer, GPS, and sensor fusion on a phone.

I'm stuck because I need to transform the Euler angles derived from a stabilized gyroscope (otherwise I could just use vectors, but the angles need to be stabilized) into a rotation matrix which I could later use for transforming the phone rotation vector from its relative state into its absolute state. Is there another way to achieve this?