Record and export movement data

Hello everyone, This post shows how you can record device motion inside Reality Composer to then use as a "testing" environment for AR experiences. Is there a way to implement such recording in another app? I basically want to create a tool that records the phones position and rotation over time and then exports to a 3d file format for later use. But recording as a 4x4 matrix and then manually writing to a collada file has turned out to be quite tedious and it hasn't been working for me. That is when I came across the article I mentioned above. If there were an implementation for this in ARKit natively that I could use, it would help a lot. Any help is greatly appreciated!

Record and export movement data
 
 
Q