An easier method than creating a star map is to use the brightest star in the sky (the sun) and an accelerometer. This is the method Opportunity uses to calibrate the gyroscopes/wheel encoders.
"The attitude of the rover is based on measurements from two vector instruments: (1) accelerometers that determine the vector towards the center of gravity of Mars and (2) Pancam solar images that determine the vector to the Sun."
[source pg 4] https://www-robotics.jpl.nasa.gov/publications/Reg_Willson/M...
"The attitude of the rover is based on measurements from two vector instruments: (1) accelerometers that determine the vector towards the center of gravity of Mars and (2) Pancam solar images that determine the vector to the Sun."