Skip to content

Commit

Permalink
Update _last_active_task_time if robot is executing task (#384)
Browse files Browse the repository at this point in the history
Signed-off-by: Charly Wu <charlywu@medinno.com>
  • Loading branch information
cwrx777 committed Sep 9, 2024
1 parent 1ab38d7 commit 4d4d693
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rmf_fleet_adapter/src/rmf_fleet_adapter/agv/RobotContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1514,10 +1514,17 @@ void RobotContext::_check_door_supervisor(
{
const auto now = std::chrono::steady_clock::now();
const auto dt = std::chrono::seconds(10);
if (_last_active_task_time + dt < now)
if (_current_task_id.has_value())
{
// Do not hold a door if a robot is idle for more than 10 seconds
_holding_door = std::nullopt;
_last_active_task_time = now;
}
else
{
if (_last_active_task_time + dt < now)
{
// Do not hold a door if a robot is idle for more than 10 seconds
_holding_door = std::nullopt;
}
}

for (const auto& door : state.all_sessions)
Expand Down

0 comments on commit 4d4d693

Please sign in to comment.