A flexible library for programming a task-based robot