Measure angle with AltIMU-10 v5

You can make a compass using the magnetometer, however it must be carefully calibrated to be useful, and may not work if your robot is near iron-containing or magnetic materials.

See this post: Correcting the Balboa magnetometer