# Revision history [back]

I agree with Chad, good catch finding the bug in AMCL.

The sampling function used in AMCL expects standard deviation as a parameter, and we are giving it something that acts like a variance.

The solution is to take the square root of the argument passed to the sampling function. As mentioned elsewhere, this may change behavior significantly, so I won't just change it and commit it. I'll first test on recorded data and on some running robots and see how different it looks. If the difference is small I might just commit the change, but if it looks like it will require everyone to re-tune their alpha values I will make new odometry model types with the corrected math, and deprecate the existing ones.

As for the math, this http://en.wikipedia.org/wiki/Variance defines variance as the expected value of the square of the difference between the variable and the mean. So

n = E[(B - b)²]

Therefore defining n = αb² just says that our error model assumes the difference between the actual and the average (B - b) grows linearly with distance (b√α), where the square root of the parameter α relates the error to the distance.

Since the variances of independent random variables add when the random variables are added, when we have different sources of error going into our model, we can add the variances together. Each variance piece is of the form αᵤᵥmᵥ², where αᵤᵥ relates to the error in the u measurement caused by motion in the v dimension, and mᵥ is the measured motion in the v dimension. α₁, α₂, α₃, and α₄ together seem to form something like a covariance matrix for the distance and rotation variables. The units of them are meters²/rad², rad²/meters², meters²/meters², and rad²/rad², respectively.