strands-project / strands_executive

Executive control code for STRANDS robots.
10 stars 19 forks source link

How do you deactivate the tasks that were successfully completed? #322

Open EliosSs opened 2 years ago

EliosSs commented 2 years ago

How do you deactivate the tasks that were successfully completed in a batch?

I was checking the code of the MDP task executor, specifically the file _mdp_task_executor.py in the kinetic-devel_ branch.

in the function: def mdp_exec(self): defined in line 954, we have the main loop for the executor, where you take the task batch from the queue and you send it to the action server with the name 'mdp_plan_exec/execute_policy'.

Right after all that process you proceed to execute the wait policy execution in line 1011:

1011 final_status = self._wait_for_policy_execution()

and it yields the result in the "final_status" variable.

My question is: How is that status variable used to deactivate the active batch in the case of successful tasks?

Right after that "wait_for_policy_execution()" function there are several lines that I understand are to recognize if some tasks were called to be cancelled (The ids of those tasks were used to call "cancel_active_task" function), between lines 1022 and 1047 in the mdp_task_executor.py file.

But the my doubt is inside the function _deactivate_active_batch_, which is called in line 1052. 1052 self.deactivate_active_batch(goal_status = final_status)

and it is defined in line 1102: 1102 def deactivate_active_batch(self, goal_status, save_all = False, description = ''):

If we go deeply at that function with the assumption that a batch of tasks was performed with a succeeded status in the final_status variable and that none of the tasks were cancelled. The call of this function is then made in line 1052 with a final_status of GoalStatus.SUCCEEDED. So as the call was in line 1052 the save_all parameter is false and we go inside the function by the line 1122.

So going back with my question in this line 1122 until line 1141. How are you deactivating the active batch without taking into account the goal status? I see that you have two lists do_not_reactivate_later = [] reactivate_later = []

But the criteria to join in one list or other is not based in the goal status? why?

Can you explain me this, please? maybe I am missing something?

I really appreciate any kind of help and the availability of the mantainers. Thank you a lot in advance.

Eliomar Conde.