Rmf would never trigger dock() to charge a robot (#313)

Posted by @b-Tomas:

In a full control fleet adapter based on full control fleet adapter template, the RobotCommandHandle::dock() is never called.

Using traffic-editor a waypoint was set as is_charger and was given a dock_name
In adapter.config.yaml, that waypoint was set as start waypoint and as charger waypoint for the robot. finishing_request in task_capabilities of the fleet configuration is set to charge, and both recharge_threshold and recharge_soc are set, as well as account_for_battery_drain.
In the RobotAPI I can see that the battery level is being retrieved correctly.

The observed behavior is:

  • The robot moves to the charger waypoint at start, as it was set in the config
  • After a task, it goes back to that point, as expected
  • When the battery level is below recharge_threshold the robot does not get any tasks assigned, but also doesn’t dock
  • the dock method of RobotCommandHandle is never called

The dock method implementation is irrelevant, because it doesn’t get executed anyways.

Seeing the example configs in rmf_demos I don’t see any relevant difference in the configuration files, but I might be missing something important.

In what situations is rmf supposed to order the robot to charge?

For reference, this is the vertex definition of the dock in my *.building.yaml file, from traffic-editor:

      - [76.448999999999998, 279.62799999999999, 0, dock, {dock_name: [1, dock], is_charger: [4, true]}]

And in my nav_graph.yaml:

      - {dock_name: dock, is_charger: true, name: dock}

Thanks in advance.


Edited by @b-Tomas at 2023-02-15T15:54:31Z

Chosen answer

Answer chosen by @b-Tomas at 2023-02-17T14:30:55Z.
Answered by @mxgrey:

Just to clarify your description: After finishing a task, the robot returns to its charging point on the graph, but it sits there idle because it does not need to charge yet? Then some time later, while it is still sitting at its charging point, it does need to charge (because the battery gradually drains, even while doing nothing), but nothing happens?

I think the issue here might be that Open-RMF is currently making an assumption that any time the robot is ordered to go to its charging waypoint, it will connect with its charger and immediately begin charging.

The current implementation of the “charging task” is to tell the robot to go to its charging waypoint on the graph and then wait there until its battery level is high enough. There isn’t an explicit command to “begin charging now”. Instead it’s assumed that the dock method for the charging waypoint will take care of connecting the robot to its charger.

Now, the reason it’s not working in your specific case: The dock command is only triggered when the robot is moving to the charger waypoint from another waypoint. If the robot reports itself as already being on its charging point then the planner believes there is no reason to tell the robot to dock.

All that being said, I would expect the dock command to be triggered when the robot is returning to its charging point after performing a task. Is that not the case? If not, then maybe there’s something else wrong that I’m not thinking of.

If it’s possible, I would recommend having the robot connect to its charger every time it returns to its charging point. That will allow your system to align with the current assumptions of Open-RMF and should fix this issue immediately. If that’s not possible or acceptable for some reason, we could consider adding a step to the Charging task that explicitly triggers a signal to command the robot to connect to a charger once it arrives at its charging point. This would be separate from the docking procedure, since docking is meant to happen when moving from one point to another on the nav graph. Do you think that would help your situation?

Posted by @mxgrey:

Just to clarify your description: After finishing a task, the robot returns to its charging point on the graph, but it sits there idle because it does not need to charge yet? Then some time later, while it is still sitting at its charging point, it does need to charge (because the battery gradually drains, even while doing nothing), but nothing happens?

I think the issue here might be that Open-RMF is currently making an assumption that any time the robot is ordered to go to its charging waypoint, it will connect with its charger and immediately begin charging.

The current implementation of the “charging task” is to tell the robot to go to its charging waypoint on the graph and then wait there until its battery level is high enough. There isn’t an explicit command to “begin charging now”. Instead it’s assumed that the dock method for the charging waypoint will take care of connecting the robot to its charger.

Now, the reason it’s not working in your specific case: The dock command is only triggered when the robot is moving to the charger waypoint from another waypoint. If the robot reports itself as already being on its charging point then the planner believes there is no reason to tell the robot to dock.

All that being said, I would expect the dock command to be triggered when the robot is returning to its charging point after performing a task. Is that not the case? If not, then maybe there’s something else wrong that I’m not thinking of.

If it’s possible, I would recommend having the robot connect to its charger every time it returns to its charging point. That will allow your system to align with the current assumptions of Open-RMF and should fix this issue immediately. If that’s not possible or acceptable for some reason, we could consider adding a step to the Charging task that explicitly triggers a signal to command the robot to connect to a charger once it arrives at its charging point. This would be separate from the docking procedure, since docking is meant to happen when moving from one point to another on the nav graph. Do you think that would help your situation?


This is the chosen answer.

Posted by @b-Tomas:

Thanks for your answer.

Based on your comment I tried a couple of different things, and found that yes, dock is triggered when going into the lane that ends in the dock. What happened was that some of the loop tasks I was using ended in the dock, so after finishing the task, as it was already in the dock point, it wouldn’t dock. dock is triggered after the task, and that works as intended. I suppose docks are not logical points for doing a task other than charging, so it is not a major issue.
About your recommendation, I agree in that charging after a task is a good idea, there is no need to change that.

Now, I think there are two issues with the way this works:

  • When RMF is started and the robots go their starting points, if the starting point is a dock, dock will not be triggered because the robot navigated straight to the dock and not trough a lane (I believe) that connected the dock and that would trigger dock. I think it is convenient to have the starting points be the docks, because it is the place they will go after a task, but they don’t charge the first time they go there.
  • When the battery level is below the charging threshold and RMF is started, the robots will not dock (as described above) and also will not receive a task, so they remain idle until someone realizes and manually sends them to the charger. For large fleets of robots, this could probably be an inconvenience.

These are not a major problems because the system is supposed to be online for long periods of time, but in case of a reset, each robot has to be checked manually or manually sent to their chargers and get docked. Not big of an issue but a little annoying, and it is something I would consider solving.

Again, thank your for your explanation.

Posted by @mxgrey:

Thanks for the feedback on your use case. It’s impossible for us to know on our own all the different ways people will want to use Open-RMF, so hearing people’s user stories is invaluable.

I have some ideas for migrating the fleet adapters from using discrete graphs over to freespace logic that would include regions of interest where system integrators can customize the robots’ behaviors. We might be able to get your use case to work better with those features.

Posted by @b-Tomas:

Sounds exciting!

Posted by @zhangyuran-gg:

I am very interested in this point and I would like to know how should we add this step? I tried to define a chargefile and send a “Charge Battery” request to fleet_adapter, the fleet_adapter seems to have successfully received the task request, But in the simulated environment,the robot did not exhibit any behavior, and subsequent tasks will be in queued state(even if the battery level is 100%).I don’t know if it can succeed in real scenarios.
So my question is: If there is a way to build this step,is it done by building a charge file,how should I build this json_msg in the charge file?
In the following image, you can see that the fleet_adapterhas successfully accepted the task, my json_msg composition, and the robot_state