Text this: New algorithm for attitude and orbit determination using magnetic field measurements