adding encoder calibration code