Heading-error-free optical atomic magnetometry in the Earth-field range