An online collision-free trajectory generation algorithm for human-robot collaboration