Development and experimental validation of algorithms for human–robot interaction in simulated and real scenarios