I'm confused how to set up an initial heading for my mobile robot project. I've determined heading from gyro integration and also using magnetometer readings. Gyro initializes at 0 and magnetometer initializes to a random value between -180 and 180 based on direction of the imu.
My question is how should I set up this parameter initially. I plan keep the range between -pi and pi, but do i want to use the global magnetic field as my reference and navigate based upon this, or do i want to offset that value to agree with the gyro at startup?
Thanks for any help!