How to detect the device orientation in the real world?

According to the Apple’s tutorial in wwdc2023, the origin of coordinate for immersive space is located at the user’s feet. Are there any ways to retrieve the device orientation data in the real world, i.e. the horizontal and vertical angle data of the device?