Rotating robot to face lift door (for exit) after entering lift (#219)

Posted by @cwrx777:

Hi,
I noticed from the waypoints in the follow_new_path that the robot only rotates to the lift door when exiting the lift. How can we get the robot to rotate right after it enters the lift?

Entering lift

[DeliveryRobot_1_CmdHandle]: >>> wp[0]:[L1_lift_entry]    [23.61, -15.03, 1.55]   [2022-09-14 10:46:23.739604]
[DeliveryRobot_1_CmdHandle]: >>> wp[1]:[None]     [23.64, -13.57, 1.55]   [2022-09-14 10:46:30.759713] -> inside lift
[DeliveryRobot_1_CmdHandle]: >>> wp[2]:[None]     [23.64, -13.57, 1.55]   [2022-09-14 10:46:30.759713] 

Exiting lift

[DeliveryRobot_1_CmdHandle]: >>> wp[0]:[None]     [23.64, -13.57, -1.59]  [2022-09-14 10:46:37.293304]
[DeliveryRobot_1_CmdHandle]: >>> wp[1]:[L2_lift_entry]    [23.62, -14.89, -1.59]  [2022-09-14 10:46:44.121047] 

Posted by @mxgrey:

With the introduction of this PR you could create a docking behavior for entering and exiting lifts. Your docking behavior could include having the robot turn around after getting into the lift.

Other potential options would be to identify which nav graph waypoints are inside of lifts, and when your robot is commanded to arrive at that point your follow_new_path implementation in your fleet adapter could automatically change the command to your robot to have it turn around. Identifying the waypoints inside of lifts isn’t completely trivial, though..

You could have your adapter integration parse the yaml file that’s given to the fleet adapter library and look for which vertices have a lift attribute. However the way you choose to index the graph vertices won’t necessarily match the way RMF indexes them, so you can’t just look at the graph_index of the path command and assume it will match your vertex indexing. Instead you’d have to store the positions of all the lift vertices and check whether each path command waypoint matches any of the lift vertices. Then you’d have to add an instruction to have your robot turn 180-degrees when it reaches that waypoint.

So … it’s certainly doable with the current rmf_fleet_adapter API, but it’s definitely not as easy or intuitive as it could be. I think it would be great to add an API to make this easier, but unfortunately it’s not on the roadmap for any of our current funded projects, so I don’t know when we’d find an opportunity to work on such an API feature.