A dry friction model and robust computational algorithm for reversible or irreversible motion transmissions