# Backpropagate robot state from vendor system to RMF core (#293)

**URL:** <https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835>\
**Category:** Open-RMF General\
**Tags:** rmf-github-discuss\
**Created:** [January 3, 2023, 1:04pm UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835 "2023-01-03T13:04:07Z")\
**Posts on this page:** 10\
**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:** [January 3, 2023, 1:04pm UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/1 "2023-01-03T13:04:07Z")

</div>

Posted by @dennis-thevara:

I’m currently using MiR robots (200 and 500 to be precise) to carry out several delivery tasks using RMF. There are occasional times when the robots enter their own E-Stops due to collisions with dynamic obstacles, or minor hardware faults. In these situations, what is the best way to pass the information about the current state of the robot from the vendor system back to RMF so that it can be accounted for in RMF-Web and all other tracking systems?

I see that the cpp implementation of the Fleet Adapter code has an `IssueTicket` class whose docstring mentions that it is used for issue tracking. Is there a python binding available for this?

> **Chosen answer**
>
> Answer chosen by @dennis-thevara at 2023-01-03T14:45:19Z.  
> Answered by @aaronchongth:
> 
> Hello! You are right, that would be the ideal way of handling such a scenario. The binding is available, you can find it here, [rmf\_ros2/rmf\_fleet\_adapter\_python/src/adapter.cpp at main · open-rmf/rmf\_ros2 · GitHub](https://github.com/open-rmf/rmf_ros2/blob/main/rmf_fleet_adapter_python/src/adapter.cpp#L277).

---

<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:** [January 3, 2023, 1:17pm UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/2 "2023-01-03T13:17:27Z")

</div>

Posted by @aaronchongth:

Hello! You are right, that would be the ideal way of handling such a scenario. The binding is available, you can find it here, [rmf\_ros2/rmf\_fleet\_adapter\_python/src/adapter.cpp at main · open-rmf/rmf\_ros2 · GitHub](https://github.com/open-rmf/rmf_ros2/blob/main/rmf_fleet_adapter_python/src/adapter.cpp#L277).

* * *

**This is the chosen answer.**

---

<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:** [January 3, 2023, 2:46pm UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/3 "2023-01-03T14:46:28Z")

</div>

Posted by @dennis-thevara:

Thanks for the quick response! I think this should be exactly what we need, I’ll experiment with it and reach out again if I have questions.

---

<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 1, 2023, 8:19am UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/4 "2023-02-01T08:19:38Z")

</div>

Posted by @dennis-thevara:

Hi! I wanted to follow up on this query with an update and a question. I was successfully able to get the state from the robot to reflect properly within the adapter and the data on the `fleet_state_update` and `fleet_log_update` websockets. This is also being accurately reflected in real time on RMF Web. However, if the robot is engaged in a task (delivery in this case), the task state continues to report `underway` while the robot is immobile and reporting an error, instead of one of the several states enumerated in `task_state.json`. What is the best way to update the task state in order to complete this feedback pipeline?

I have experimented with the `Interruption` class by calling `RobotUpdateHandle::interrupt` when the robot state is set to `Error`, but this doesn’t modify the task state in RMF Web or in the websocket data. Perhaps I am using this incorrectly, or this is not the intended mechanism for updating a task state based on robot state.

I have also been looking into the action executor, but my understanding is that I shouldn’t be creating a new one when a delivery task is underway, but instead interfacing with whichever executor is active for that task. Is there a way to access this? I had updated my fleet adapter code to include the instantiation of an action executor exactly the same way as the [\_updater\_inserter](https://github.com/open-rmf/rmf_demos/blob/main/rmf_demos_fleet_adapter/rmf_demos_fleet_adapter/fleet_adapter.py#L168) in the `rmf_demos_fleet_adapter` code, but it doesn’t seem to set an action executor during launch. I’ve tried to verify by logging a debug statement after the function call, which prints correctly for the RMF Demos adapter, but not mine.

* * *

Edited by @dennis-thevara at 2023-02-01T08:25:16Z

---

<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 1, 2023, 9:20am UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/5 "2023-02-01T09:20:12Z")

</div>

Posted by @aaronchongth:

Hello @dennis-thevara! Am I right to assume that you would like the tasks to fail when the robot has an issue?

If so, alongside creating an `IssueTicket` as mentioned in our discussion above, you would need to cancel or kill the task as well, depending on your use case and preference. [rmf\_ros2/rmf\_fleet\_adapter/include/rmf\_fleet\_adapter/agv/RobotUpdateHandle.hpp at main · open-rmf/rmf\_ros2 · GitHub](https://github.com/open-rmf/rmf_ros2/blob/main/rmf_fleet_adapter/include/rmf_fleet_adapter/agv/RobotUpdateHandle.hpp#L226-L260)

Regarding `Interruption`, it is used for interrupting the control RMF has over the robot, for example, when we want to teleoperate the robot, and prevent the fleet adapter to continue to send commands to the robot while we handle it.

---

<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 2, 2023, 3:18am UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/6 "2023-02-02T03:18:03Z")

</div>

Posted by @dennis-thevara:

Hello @aaronchongth! Yes one of the responses I want is for the task to be cancelled for which `cancel_task` will work, but I would also like to be able to specify states like `blocked` or `delayed` in certain situations such as a dynamic obstacle that blocks a node on the node graph but then is cleared away, allowing for the robot to reach the destination and complete the task.

Basically curious if there is a generic task state override, similar to the `override_status` method made available by the `RobotCommandHandle`, where I can assign to the currently executing task one of the valid task states in the `task_state.json` enum.

Thank you for the clarification on `Interruption` as well, it should come in handy for manual control overrides.

---

<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 2, 2023, 6:04am UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/7 "2023-02-02T06:04:11Z")

</div>

Posted by @aaronchongth:

The allowed statuses are these enums,  
robot state: [rmf\_api\_msgs/rmf\_api\_msgs/schemas/robot\_state.json at main · open-rmf/rmf\_api\_msgs · GitHub](https://github.com/open-rmf/rmf_api_msgs/blob/main/rmf_api_msgs/schemas/robot_state.json#L12)  
task state: [rmf\_api\_msgs/rmf\_api\_msgs/schemas/task\_state.json at main · open-rmf/rmf\_api\_msgs · GitHub](https://github.com/open-rmf/rmf_api_msgs/blob/main/rmf_api_msgs/schemas/task_state.json#L184)

I believe what you are looking for at the moment is not supported. If I understand correctly, you would like a more granular status update regarding what the robot is encountering, a warning of sorts but with the robot still continuing with it’s task. I would then suggest to just log this encounter, where the logs can be monitored through the robot or task state.

---

<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 2, 2023, 7:30am UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/8 "2023-02-02T07:30:03Z")

</div>

Posted by @dennis-thevara:

Hi, yes I’ve seen those enums. You’re right that I’d like to have a more specific task status update but only within the allowed states listed in the enum.

For example, if a waypoint on the navgraph is blocked, I have the robot state set to `Error` as per the robot state enum. At the same time, I’d like to set the currently executing task from `underway` to `blocked`, which is one of the valid states in the task states enum. Since this is not supported at the moment, I’ll go by your recommendation to use logs instead, but perhaps the RMF team could consider adding this interface to the `RobotCommandHandle` as a new feature at some point if it sounds useful.

Thank you for your help!

---

<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 2, 2023, 8:59am UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/9 "2023-02-02T08:59:19Z")

</div>

Posted by @aaronchongth:

There is currently support for setting `blocked` to action executions, which are custom user-defined actions for robots, [rmf\_ros2/rmf\_fleet\_adapter/include/rmf\_fleet\_adapter/agv/RobotUpdateHandle.hpp at main · open-rmf/rmf\_ros2 · GitHub](https://github.com/open-rmf/rmf_ros2/blob/main/rmf_fleet_adapter/include/rmf_fleet_adapter/agv/RobotUpdateHandle.hpp#L128-L179), but not for the default navigation commands. It could certainly be added from the `TaskManager` side and subsequently in the `RobotUpdateHandle` as well. Since this might be useful for your use case and possibly many others, would you like to implement and contribute it upstream?

---

<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 2, 2023, 9:09am UTC](https://discourse.openrobotics.org/t/backpropagate-robot-state-from-vendor-system-to-rmf-core-293/44835/10 "2023-02-02T09:09:10Z")

</div>

Posted by @dennis-thevara:

My team and I were considering the possibility that we’d have to implement this feature. We could certainly explore that and see if we can get it to work. I’ll keep you posted if we’re able to put it together soon.
