Skip to content

Commit

Permalink
Unify return to home and docking naming
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Jan 2, 2025
1 parent 9009f16 commit 14a5f25
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public MissionRunQueryStringParameters()
public MissionRunType? MissionRunType { get; set; }

/// <summary>
/// Filter for whether the result should exclude return to home missions. The default is false
/// Filter for whether the result should exclude return home missions. The default is false
/// </summary>
public bool ExcludeReturnToHome { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion backend/api/Controllers/ReturnToHomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ await returnToHomeService.ScheduleReturnToHomeMissionRunIfNotAlreadyScheduledOrR
);
if (returnToHomeMission is null)
{
string errorMessage = "Error while scheduling Return to Home mission";
string errorMessage = "Error while scheduling Return home mission";
logger.LogError(errorMessage);
return StatusCode(StatusCodes.Status502BadGateway, $"{errorMessage}");
}
Expand Down
2 changes: 1 addition & 1 deletion backend/api/Database/Models/MissionRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class MissionRun : SortableRecord
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }

//[Required] // See "Drive to Docking Station" mission in RobotController.cs
//[Required] // Return home missions do not have a corresponding MissionDefinition
public string? MissionId { get; set; }

[Required]
Expand Down
2 changes: 1 addition & 1 deletion backend/api/Database/Models/MissionTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public MissionTask(Pose robotPose, MissionTaskType type)
{
case MissionTaskType.ReturnHome:
Type = type;
Description = "Return to home";
Description = "Return home";
RobotPose = robotPose;
TaskOrder = 0;
Status = TaskStatus.NotStarted;
Expand Down
16 changes: 7 additions & 9 deletions backend/api/Services/MissionSchedulingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ await returnToHomeService.ScheduleReturnToHomeMissionRunIfNotAlreadyScheduledOrR
{
signalRService.ReportGeneralFailToSignalR(
robot,
$"Failed to schedule return to home for robot {robot.Name}",
$"Failed to schedule return home for robot {robot.Name}",
""
);
logger.LogError(
"Failed to schedule a return to home mission for robot {RobotId}",
"Failed to schedule a return home mission for robot {RobotId}",
robot.Id
);
}
Expand Down Expand Up @@ -173,7 +173,7 @@ await returnToHomeService.ScheduleReturnToHomeMissionRunIfNotAlreadyScheduledOrR
catch (ReturnToHomeMissionFailedToScheduleException)
{
logger.LogError(
"Failed to schedule a return to home mission for robot {RobotId}",
"Failed to schedule a return home mission for robot {RobotId}",
robot.Id
);
}
Expand Down Expand Up @@ -269,7 +269,7 @@ await returnToHomeService.ScheduleReturnToHomeMissionRunIfNotAlreadyScheduledOrR
catch (ReturnToHomeMissionFailedToScheduleException)
{
logger.LogError(
"Failed to schedule a return to home mission for robot {RobotId}",
"Failed to schedule a return home mission for robot {RobotId}",
robot.Id
);
return null;
Expand Down Expand Up @@ -435,7 +435,7 @@ public async Task ScheduleMissionToDriveToDockPosition(string robotId)

var missionRun = new MissionRun
{
Name = "Drive to Docking Station",
Name = "Return home",
Robot = robot,
MissionRunType = MissionRunType.Emergency,
InstallationCode = robot.CurrentInstallation.InstallationCode,
Expand Down Expand Up @@ -501,9 +501,7 @@ IEnumerable<string> interruptedMissionRunIds

if (missionRun.IsReturnHomeMission())
{
logger.LogWarning(
"Return to home mission will not be added back to the queue."
);
logger.LogWarning("Return home mission will not be added back to the queue.");
return;
}

Expand Down Expand Up @@ -671,7 +669,7 @@ public async Task AbortActiveReturnToHomeMission(string robotId)
if (activeReturnToHomeMission == null)
{
logger.LogWarning(
"Attempted to abort active Return to Home mission for robot with Id {RobotId} but none was found",
"Attempted to abort active Return home mission for robot with Id {RobotId} but none was found",
robotId
);
return;
Expand Down
7 changes: 3 additions & 4 deletions backend/api/Services/ReturnToHomeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ string robotId
)
{
logger.LogInformation(
"Scheduling return to home mission if not already scheduled or the robot is home for robot {RobotId}",
"Scheduling return home mission if not already scheduled or the robot is home for robot {RobotId}",
robotId
);
var lastMissionRun = await missionRunService.ReadLastExecutedMissionRunByRobot(robotId);
Expand Down Expand Up @@ -60,7 +60,6 @@ or UnsupportedRobotCapabilityException
or MissionRunNotFoundException
)
{
// TODO: if we make ISAR aware of return to home missions, we can avoid scheduling them when the robot does not need them
throw new ReturnToHomeMissionFailedToScheduleException(ex.Message);
}

Expand Down Expand Up @@ -118,7 +117,7 @@ robot.RobotCapabilities is not null

var returnToHomeMissionRun = new MissionRun
{
Name = "Return to home mission",
Name = "Return home",
Robot = robot,
InstallationCode = robot.CurrentInstallation.InstallationCode,
MissionRunType = MissionRunType.ReturnHome,
Expand Down Expand Up @@ -163,7 +162,7 @@ robot.RobotCapabilities is not null
if (activeReturnToHomeMissions.Count > 1)
{
logger.LogError(
$"Two Return to Home missions should not be queued or ongoing simoultaneously for robot with Id {robotId}."
$"Two Return home missions should not be queued or ongoing simoultaneously for robot with Id {robotId}."
);
}

Expand Down

0 comments on commit 14a5f25

Please sign in to comment.