diff --git a/backend/api/Database/Models/MissionRun.cs b/backend/api/Database/Models/MissionRun.cs index 1aabe673a..d95da39b6 100644 --- a/backend/api/Database/Models/MissionRun.cs +++ b/backend/api/Database/Models/MissionRun.cs @@ -192,7 +192,7 @@ var inspection in task.Inspections.Where(inspection => !inspection.IsCompleted) public bool IsLocalizationMission() { return Tasks is [{ Type: MissionTaskType.Localization }]; } - public bool IsDriveToMission() { return Tasks is [{ Type: MissionTaskType.DriveTo }]; } + public bool IsReturnHomeMission() { return Tasks is [{ Type: MissionTaskType.ReturnHome }]; } } public enum MissionStatus diff --git a/backend/api/Database/Models/MissionTask.cs b/backend/api/Database/Models/MissionTask.cs index 0b5c944ff..228a0c7f8 100644 --- a/backend/api/Database/Models/MissionTask.cs +++ b/backend/api/Database/Models/MissionTask.cs @@ -56,7 +56,7 @@ public MissionTask(Pose robotPose, MissionTaskType type) Status = TaskStatus.NotStarted; Inspections = new List(); break; - case MissionTaskType.DriveTo: + case MissionTaskType.ReturnHome: Type = type; Description = "Return to home"; RobotPose = robotPose; @@ -65,7 +65,7 @@ public MissionTask(Pose robotPose, MissionTaskType type) Inspections = new List(); break; default: - throw new MissionTaskNotFoundException("MissionTaskType should be Localization or DriveTo"); + throw new MissionTaskNotFoundException("MissionTaskType should be Localization or ReturnHome"); } } @@ -175,7 +175,7 @@ public void UpdateStatus(IsarTaskStatus isarStatus) public static string ConvertMissionTaskTypeToIsarTaskType(MissionTaskType missionTaskType) { - if (missionTaskType == MissionTaskType.DriveTo) { return "drive_to"; } + if (missionTaskType == MissionTaskType.ReturnHome) { return "drive_to"; } else { return missionTaskType.ToString().ToLower(CultureInfo.CurrentCulture); } } } @@ -195,6 +195,6 @@ public enum MissionTaskType { Inspection, Localization, - DriveTo + ReturnHome } } diff --git a/backend/api/Services/MissionRunService.cs b/backend/api/Services/MissionRunService.cs index df6d34aae..c92492714 100644 --- a/backend/api/Services/MissionRunService.cs +++ b/backend/api/Services/MissionRunService.cs @@ -191,7 +191,7 @@ public async Task PendingOrOngoingReturnToHomeMissionRunExists(string robo var pendingMissionRuns = await ReadMissionRunQueue(robotId); foreach (var pendingMissionRun in pendingMissionRuns) { - if (pendingMissionRun.IsDriveToMission()) { return true; } + if (pendingMissionRun.IsReturnHomeMission()) { return true; } } var ongoingMissionRuns = await GetMissionRunsWithSubModels() .Where(missionRun => missionRun.Robot.Id == robotId && missionRun.Status == MissionStatus.Ongoing) @@ -199,7 +199,7 @@ public async Task PendingOrOngoingReturnToHomeMissionRunExists(string robo .ToListAsync(); foreach (var ongoingMissionRun in ongoingMissionRuns) { - if (ongoingMissionRun.IsDriveToMission()) { return true; } + if (ongoingMissionRun.IsReturnHomeMission()) { return true; } } return false; @@ -398,7 +398,7 @@ MissionRunQueryStringParameters parameters Expression> returnTohomeFilter = !parameters.ExcludeReturnToHome ? missionRun => true - : missionRun => !(missionRun.Tasks.Count() == 1 && missionRun.Tasks.All(task => task.Type == MissionTaskType.DriveTo)); + : missionRun => !(missionRun.Tasks.Count() == 1 && missionRun.Tasks.All(task => task.Type == MissionTaskType.ReturnHome)); var minStartTime = DateTimeUtilities.UnixTimeStampToDateTime(parameters.MinStartTime); var maxStartTime = DateTimeUtilities.UnixTimeStampToDateTime(parameters.MaxStartTime); diff --git a/backend/api/Services/ReturnToHomeService.cs b/backend/api/Services/ReturnToHomeService.cs index 9f0335ef1..43636c977 100644 --- a/backend/api/Services/ReturnToHomeService.cs +++ b/backend/api/Services/ReturnToHomeService.cs @@ -45,7 +45,7 @@ private async Task IsRobotHome(string robotId) return false; } - return lastExecutedMissionRun.IsDriveToMission(); + return lastExecutedMissionRun.IsReturnHomeMission(); } private async Task IsReturnToHomeMissionAlreadyScheduled(string robotId) { @@ -98,7 +98,7 @@ private async Task ScheduleReturnToHomeMissionRun(string robotId) DesiredStartTime = DateTime.UtcNow, Tasks = new List { - new(new Pose(robot.CurrentArea.Deck.DefaultLocalizationPose.Pose), MissionTaskType.DriveTo) + new(new Pose(robot.CurrentArea.Deck.DefaultLocalizationPose.Pose), MissionTaskType.ReturnHome) }, Map = new MapMetadata() };