An Ergonomic Role Allocation Framework for Dynamic Human-Robot Collaborative Tasks