Lift session issues - Robot enter lift while lift is still in human mode (#513)

Posted by @cwrx777:

related discussion: open-rmf#454

Occasionally we have encountered that robot enters lift when the door is open but the lift is not yet in AGV mode.
Should this code also check if the lift is already in AGV mode? e.g.

LegacyTask::StatusMsg RequestLift::ActivePhase::_get_status(
  const rmf_lift_msgs::msg::LiftState::SharedPtr& lift_state)
{
  using rmf_lift_msgs::msg::LiftState;
  using rmf_lift_msgs::msg::LiftRequest;
  LegacyTask::StatusMsg status{};
  status.state = LegacyTask::StatusMsg::STATE_ACTIVE;
  if (!_rewaiting &&
    lift_state->lift_name == _lift_name &&
    lift_state->current_floor == _destination &&
    lift_state->door_state == LiftState::DOOR_OPEN &&
    lift_state->current_mode == LiftState::MODE_AGV &&  //check if the lift is AGV mode
    lift_state->session_id == _context->requester_id())
  {
    RCLCPP_INFO(
      _context->node()->get_logger(),
      "Lift has arrived on floor [%s] and opened its doors for robot [%s]",
      lift_state->current_floor.c_str(),
      lift_state->session_id.c_str());
...

Posted by @mxgrey:

It’s a fair question…

The intention of the message protocol is that when the lift state has a session ID which matches the session ID of the fleet’s request, then that means the lift is already locked into a session with the fleet and obeying the fleet’s requests.

Therefore if it’s necessary for the lift to be in a special AGV mode in order to safely satisfy the needs of the session, then it should not broadcast the session_id value until it has finished switching into that mode.

Some lifts might not have a special AGV mode, in which case the lift state wouldn’t have any reason to send a different mode value.

My recommendation would be to tweak your lift adapter so that right before you publish the lift state message, first you check if the current_mode field has a MODE_AGV value. If it doesn’t then just clear the session_id field right before publishing it. This way the fleet adapter will not think the lift is locked into the session prematurely.


Edited by @mxgrey at 2024-08-21T06:00:50Z