The present disclosure relates to a method of determining an offset between a detector and a point on a motor, the movement of the point on the motor being impeded in at least one direction. In particular, this disclosure relates to a method of determining a commutation offset for an encoder that works in conjunction with a synchronous motor. The commutation offset is an offset between the detector and the north pole of a permanent magnet within the motor. The method comprises setting a test value for the offset, causing a displacement of the detector based on the test value and measuring that displacement. The method further comprises repeatedly increasing the test value, and causing and measuring a displacement for each so increased test value until it is determined that the test value has crossed a threshold.