  The new paradigm of human-robot collaboration has led to the creation of
shared work environments in which humans and robots work in close contact with
each other. Consequently, the safety regulations have been updated addressing
these new scenarios. The mere application of these regulations may lead to a
very inefficient behavior of the robot. In order to preserve safety for the
human operators and allow the robot to reach a desired configuration in a safe
and efficient way, a two layers architecture for trajectory planning and
scaling is proposed. The first layer calculates the nominal trajectory and
continuously adapts it based on the human behavior. The second layer, which
explicitly considers the safety regulations, scales the robot velocity and
requests for a new trajectory if the robot speed drops. The proposed
architecture is experimentally validated on a Pilz PRBT manipulator.
