in Robot/src/orchestrated_robot/scripts/robot_controller.py [0:0]
def handle_job_new(self, job):
try:
rospy.loginfo("Got Job: " + str(job))
self.job_lock.acquire()
try:
# Decline job if robot is busy
if (self.robot_status == RobotStatus.Busy):
self.handle_job_fail(job)
return
job.Status = JobStatus.InProgress.value
self.update_robot_state(RobotStatus.Busy, job)
finally:
self.job_lock.release()
self.execute_job(job)
except Exception as e:
rospy.logerr("Something went wrong: " + str(e))
self.handle_job_fail(job)
self.set_robot_to_failed()
# Flush stdout
sys.stdout.flush()