Added logic for robot control thread management.