Impedance control code for a robotic joint