Hierarchical Control for Robots in an Automated Factory