The easy answer is to use a surveyed direction.
A map, your position, and a landmark out a window, a rifle scope and there you go.
Worst case you need to get a couple or three points surveyed.
In geodesy, setting up observatories, testing ranging gear, all the same problems.
Then you use the correct magnetic variation for your location. ( you'll end up knowing your countries geodesy service pretty well by the end of this).
If you just need some known points to calibrate from, then...
It's relatively simple to get 0, 90, 180 and 270 degrees from that with cheap hardware.
A rotation stage, even an industrial one for a milling machine will give almost any given angle.
(Magnetic compensation for metal equipment may be a pain. Just a plastic 360 degree protractor and some wood will do for all but very fine work.) [I have seen it used in compass calibration before.... if you need more accuracy, make a bigger protractor on a huge bit of cardboard.]
We used to used computer-driven rotation stages to calibrate gravity sensors.
The people we bought IMU's from used a robot arm to test the IMU.
For compasses, a cardboard compass rose and wooden/plastic pivots.
If you need very fine variation, I pity you. Maybe use a coil set.
No, it's not a stupid question. Reweighting (or resampling) particles is non-trivial for any "fun" problem. Weighting is typically performed by computing the likelihood of the particle fitting the observation. See page 28 here. This link and this link give reasonable discussion on particle resampling.
These links assume you can easily compute the likelihood a particle corresponds to the observations. For ease, we typically assume the likelihood can be expressed as a normal distribution (i.e. with a mean and a variance). Since your observations are comprised multiple dimensions, you might use the multivariate version of the
normal distribution.
Best Answer
First, to keep in mind: gyroscopes measure how fast you are turning and in what direction. Compasses measure your orientation to the earth's magnetic pole.
Positive Side of Gyroscopes:
With this in mind, we can see that gyroscopes won't be as sensitive to external magnetic fields as compasses will be. So, if there's an opportunity for your device to come close to a magnet, a compass may not be what you want.
Also, gyroscopes will work even in space, whereas compasses won't really work. (Side note: well, actually, the compass will still work, it just might not work in the way you want it to.)
Negative Side of Gyroscopes:
Since a gyroscope measures the how fast you're turning, and not really how far you've turned, you must perform numeric integration (of some form or another) to estimate your actual heading. This means that some error can be introduced. Along the same lines, because the sensor value for the current heading is dependent on all those that came before, any significant error in reading from the gyro could throw your calculations off permanently.
Also, a gyroscope is a relative reading, whereas a compass is absolute. The gyro will tell you how much you've turned since you begun the numeric integration, but it has no way of knowing if it started off pointing north or south.