Statemachine for multiple robot applications