Human-Robot Collaboration: Twofold strategy algorithm to avoid collisions using ToF sensor