There are actually two questions hereseveral issues in this question which I will answer separately.
- Error is sqrt((xm - xgt)^2)
1) Error is: $$\sqrt{(x_m-x_{gt})^2}$$
No, error is just (xm - xgt).$$(x_m - x_{gt})$$ This may be part of your problem with zero means because any error distribution will have a positive mean if you force all errors to be positive.
- My error distribution does not have zero mean. How do I compensate for that?
2) My error distribution does not have zero mean. How do I compensate for that?
Even after fixing that first issue, you may still have a non-zero mean. This can be fixed.
Determine the actual mean and use that to adjust any values that you receive from the sensor. This is called sensor calibration. So if you know that your sensor has a mean error of 8.3 and you receive a sensor measurement of 15, then you should treat that as a sensor measurement of 6.7 (15 - 8.3).
- My error distribution is not gaussian. Is it okay to fit a gaussian to that distribution anyway?
3) My error distribution is not gaussian. Is it okay to fit a gaussian to that distribution anyway?
Real error distributions are rarely gaussian, so fitting a gaussian is necessary. Unfortunately this does create a tradeoff for you to consider. If your gaussian is a good fit for the data in the 0-20 range then I think it will underestimate the probability of the outliers in the 30-50 range. That would cause your kalman filter to be overconfident and bounce around. Fitting a gaussian with larger sigma to include those values in the 30-50 range will result in smoother, but less precise output. The best result probably lies somewhere in between, so you'll need to experiment with that.