adding some functions for impedance control