Skip to content

Commit

Permalink
update reasoner
Browse files Browse the repository at this point in the history
Set objetive to false after deleting it
  • Loading branch information
marioney committed Mar 3, 2021
1 parent cb8be7a commit cbf4689
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mros2_reasoner/mros2_reasoner/ros_reasoner.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,22 @@ def set_initial_fd(self, initial_fd):
def objective_cancel_goal_callback(self, cancel_request):
self.get_logger().info("Cancel Action Callback!")
# Stop reasoning
self.hasObjective = False

if (cancel_request.qos_expected is None):
# Checks if there are previously defined objectives.
for old_objective in self.reasoner.search_objectives():
self.reasoner.remove_objective(old_objective.name)
self.hasObjective = False
return CancelResponse.ACCEPT
else:
if self.reasoner.remove_objective(cancel_request.qos_expected.objective_id):
self.get_logger().info("Objective Cancelled")
self.hasObjective = False
return CancelResponse.ACCEPT
else:
self.get_logger().info("Not found")
return CancelResponse.REJECT




Expand Down

0 comments on commit cbf4689

Please sign in to comment.