Hello,

About "weighted average".

Probably this is it:

Let's say, that you have two inputs: x and y (x, y are numbers).

We need two other numbers (the "weights"), let them are a and b.

Weighted average of x,y is the next: (a*x + b*y)/(a+b)

The normal average is (x+y)/2, where the x and y are equally "important".

With weighted average, you can make one of x and y more "stronger" than the other. The stronger input will influence the output more.

Now back to your question:

You have three inputs: IR, E1 and E2 encoders.

Let us say, that you counted the headings from the inputs : hIR, hE1,hE2, for example:

hIR=60, hE1=50, hE2=52 (grads).

The average will be (60+50+52)/3=54, so your robot's head is in 54 grad.

But, you experimented, that the encoders are not as good as you planned, so you should make the IR inputs stronger:

(2*60+1*50+1*52)/(2+1+1)=55

Now your problem is, which numbers should you use as weights.