# How to make robot inactive when its task is canceled just as what interrupt\_task does (#307)

**URL:** <https://discourse.openrobotics.org/t/how-to-make-robot-inactive-when-its-task-is-canceled-just-as-what-interrupt-task-does-307/44833>\
**Category:** Open-RMF General\
**Tags:** rmf-github-discuss\
**Created:** [February 3, 2023, 8:00am UTC](https://discourse.openrobotics.org/t/how-to-make-robot-inactive-when-its-task-is-canceled-just-as-what-interrupt-task-does-307/44833 "2023-02-03T08:00:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Archive-o-matic](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/archive-o-matic/32/26074_2.png) [@Archive-o-matic](https://discourse.openrobotics.org/u/Archive-o-matic)\
**Post date:** [February 3, 2023, 8:00am UTC](https://discourse.openrobotics.org/t/how-to-make-robot-inactive-when-its-task-is-canceled-just-as-what-interrupt-task-does-307/44833/1 "2023-02-03T08:00:28Z")

</div>

Posted by @[Missing data]:

Hi,

What I want is:  
When the task is canceld, RMF stops making assumptions about what your robot is doing, that is it will no longer be on the traffic schedule. Just like the behavior as interrupt\_task.

How can I do it? I tried to use undate\_handle.enable\_responsive\_wait(False).  
But the result is not what I want.

---

<div class="post-metadata">

**Author:** ![Archive-o-matic](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/archive-o-matic/32/26074_2.png) [@Archive-o-matic](https://discourse.openrobotics.org/u/Archive-o-matic)\
**Post date:** [February 3, 2023, 8:36am UTC](https://discourse.openrobotics.org/t/how-to-make-robot-inactive-when-its-task-is-canceled-just-as-what-interrupt-task-does-307/44833/2 "2023-02-03T08:36:50Z")

</div>

Posted by @[Missing data]:

sorry, undate\_handle.enable\_responsive\_wait(False) does work.  
Is there any other method to do this?

---

<div class="post-metadata">

**Author:** ![Archive-o-matic](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/archive-o-matic/32/26074_2.png) [@Archive-o-matic](https://discourse.openrobotics.org/u/Archive-o-matic)\
**Post date:** [February 3, 2023, 9:34am UTC](https://discourse.openrobotics.org/t/how-to-make-robot-inactive-when-its-task-is-canceled-just-as-what-interrupt-task-does-307/44833/3 "2023-02-03T09:34:39Z")

</div>

Posted by @[Missing data]:

In fact, I want to know how interrupt\_task does

---

<div class="post-metadata">

**Author:** ![Archive-o-matic](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/archive-o-matic/32/26074_2.png) [@Archive-o-matic](https://discourse.openrobotics.org/u/Archive-o-matic)\
**Post date:** [February 6, 2023, 1:58am UTC](https://discourse.openrobotics.org/t/how-to-make-robot-inactive-when-its-task-is-canceled-just-as-what-interrupt-task-does-307/44833/4 "2023-02-06T01:58:27Z")

</div>

Posted by @mxgrey:

At any time you can use [`interrupt`](https://github.com/open-rmf/rmf_ros2/blob/84f96d17e40f8d452cd6c8d534cf319073711bbc/rmf_fleet_adapter/include/rmf_fleet_adapter/agv/RobotUpdateHandle.hpp#L214-L224) ([python API](https://github.com/open-rmf/rmf_ros2/blob/84f96d17e40f8d452cd6c8d534cf319073711bbc/rmf_fleet_adapter_python/src/adapter.cpp#L222-L225)) in your fleet adapter to stop the robot from being managed by RMF.

You can combine that with the (unstable) [decommission](https://github.com/open-rmf/rmf_ros2/blob/84f96d17e40f8d452cd6c8d534cf319073711bbc/rmf_fleet_adapter_python/src/adapter.cpp#L147-L152) function to prevent the task dispatcher from assigning any more tasks to the robot. Any tasks the robot currently has will remain in its queue unless you cancel them.

I think that combination of `interrupt` and `unstable_decommision` should get you the results you’re looking for. Unfortunately these APIs are only available in the C++/Python libraries and are not yet available from [`rmf_api_msgs`](https://github.com/open-rmf/rmf_api_msgs/tree/main/rmf_api_msgs/schemas).

---

<div class="post-metadata">

**Author:** ![Archive-o-matic](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/archive-o-matic/32/26074_2.png) [@Archive-o-matic](https://discourse.openrobotics.org/u/Archive-o-matic)\
**Post date:** [February 6, 2023, 1:59am UTC](https://discourse.openrobotics.org/t/how-to-make-robot-inactive-when-its-task-is-canceled-just-as-what-interrupt-task-does-307/44833/5 "2023-02-06T01:59:53Z")

</div>

Posted by @mxgrey:

As for [`interrupt_task_request.json`](https://github.com/open-rmf/rmf_api_msgs/blob/main/rmf_api_msgs/schemas/interrupt_task_request.json), that schema allows a specific task to be interrupted, so it is different from the `interrupt` method provided by the C++/Python API. We should consider adding an `interrupt_robot_request.json` that would match what the C++/Pyhton API can do.
