Skip to content

Commit

Permalink
Add more delocalisation situations
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Jun 19, 2024
1 parent bb60026 commit 0909641
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/api/EventHandlers/IsarConnectionEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private async void OnTimeoutEvent(IsarRobotHeartbeatMessage robotHeartbeatMessag
{
await RobotService.UpdateRobotIsarConnected(robot.Id, false);
await RobotService.UpdateCurrentMissionId(robot.Id, null);
await RobotService.UpdateCurrentArea(robot.Id, null);
}
catch (RobotNotFoundException) { return; }
}
Expand Down
14 changes: 14 additions & 0 deletions backend/api/EventHandlers/MqttEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private async void OnIsarStatus(object? sender, MqttReceivedArgs mqttArgs)
_logger.LogInformation("Updated status for robot {Name} to {Status}", robot.Name, isarStatus.Status);

if (isarStatus.Status == RobotStatus.Available) missionSchedulingService.TriggerRobotAvailable(new RobotAvailableEventArgs(robot.Id));
else if (isarStatus.Status == RobotStatus.Offline) await robotService.UpdateCurrentArea(robot.Id, null);
}

private async void OnIsarRobotInfo(object? sender, MqttReceivedArgs mqttArgs)
Expand Down Expand Up @@ -290,6 +291,19 @@ private async void OnIsarMissionUpdate(object? sender, MqttReceivedArgs mqttArgs
}
}

if (flotillaMissionRun.IsReturnHomeMission() && (flotillaMissionRun.Status == MissionStatus.Cancelled || flotillaMissionRun.Status == MissionStatus.Failed))
{
try
{
await robotService.UpdateCurrentArea(robot.Id, null);
}
catch (RobotNotFoundException)
{
_logger.LogError("Could not find robot '{RobotName}' with ID '{Id}'", robot.Name, robot.Id);
return;
}
}

try { await robotService.UpdateCurrentMissionId(robot.Id, null); }
catch (RobotNotFoundException)
{
Expand Down

0 comments on commit 0909641

Please sign in to comment.