Skip to content

Commit dc6a664

Browse files
committed
Remove arm move missions
1 parent 7402b02 commit dc6a664

File tree

12 files changed

+1
-319
lines changed

12 files changed

+1
-319
lines changed

backend/api.test/Mocks/IsarServiceMock.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ public async Task ResumeMission(Robot robot)
4141
await Task.Run(() => Thread.Sleep(1));
4242
}
4343

44-
public async Task<IsarMission> StartMoveArm(Robot robot, string position)
45-
{
46-
await Task.Run(() => Thread.Sleep(1));
47-
var isarServiceMissionResponse = new IsarMission(
48-
new IsarStartMissionResponse { MissionId = "testStartMoveArm", Tasks = [] }
49-
);
50-
return isarServiceMissionResponse;
51-
}
52-
5344
public async Task<MediaConfig?> GetMediaStreamConfig(Robot robot)
5445
{
5546
await Task.Run(() => Thread.Sleep(1));

backend/api/Controllers/RobotController.cs

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -670,80 +670,6 @@ public async Task<ActionResult> ResumeMission([FromRoute] string robotId)
670670
return NoContent();
671671
}
672672

673-
/// <summary>
674-
/// Post new arm position ("battery_change", "transport", "lookout") for the robot with id 'robotId'
675-
/// </summary>
676-
/// <remarks>
677-
/// <para> This query moves the arm to a given position for a given robot </para>
678-
/// </remarks>
679-
[HttpPut]
680-
[Authorize(Roles = Role.User)]
681-
[Route("{robotId}/SetArmPosition/{armPosition}")]
682-
[ProducesResponseType(StatusCodes.Status204NoContent)]
683-
[ProducesResponseType(StatusCodes.Status400BadRequest)]
684-
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
685-
[ProducesResponseType(StatusCodes.Status403Forbidden)]
686-
[ProducesResponseType(StatusCodes.Status404NotFound)]
687-
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
688-
public async Task<ActionResult> SetArmPosition(
689-
[FromRoute] string robotId,
690-
[FromRoute] string armPosition
691-
)
692-
{
693-
robotId = Sanitize.SanitizeUserInput(robotId);
694-
armPosition = Sanitize.SanitizeUserInput(armPosition);
695-
696-
var robot = await robotService.ReadById(robotId, readOnly: true);
697-
if (robot == null)
698-
{
699-
string errorMessage = $"Could not find robot with id {robotId}";
700-
logger.LogWarning("{Message}", errorMessage);
701-
return NotFound(errorMessage);
702-
}
703-
704-
if (robot.Status is not RobotStatus.Available && robot.Status is not RobotStatus.Home)
705-
{
706-
string errorMessage =
707-
$"Robot {robotId} has status ({robot.Status}) and is not available";
708-
logger.LogWarning("{Message}", errorMessage);
709-
return Conflict(errorMessage);
710-
}
711-
712-
if (robot.Deprecated)
713-
{
714-
string errorMessage =
715-
$"Robot {robotId} is deprecated ({robot.Status}) and cannot run missions";
716-
logger.LogWarning("{Message}", errorMessage);
717-
return Conflict(errorMessage);
718-
}
719-
720-
try
721-
{
722-
await isarService.StartMoveArm(robot, armPosition);
723-
}
724-
catch (HttpRequestException e)
725-
{
726-
string errorMessage = $"Error connecting to ISAR at {robot.IsarUri}";
727-
logger.LogError(e, "{Message}", errorMessage);
728-
await errorHandlingService.HandleLosingConnectionToIsar(robot.Id);
729-
return StatusCode(StatusCodes.Status502BadGateway, errorMessage);
730-
}
731-
catch (MissionArmPositionException e)
732-
{
733-
const string ErrorMessage = "Unable to set the arm position mission";
734-
logger.LogError(e, "{Message}", ErrorMessage);
735-
return StatusCode(StatusCodes.Status400BadRequest, ErrorMessage);
736-
}
737-
catch (JsonException e)
738-
{
739-
const string ErrorMessage = "Error while processing of the response from ISAR";
740-
logger.LogError(e, "{Message}", ErrorMessage);
741-
return StatusCode(StatusCodes.Status500InternalServerError, ErrorMessage);
742-
}
743-
744-
return NoContent();
745-
}
746-
747673
/// <summary>
748674
/// Empties the mission queue for the robot, stops the ongoing mission, sets the robot to available and current inspection area is set to null
749675
/// </summary>

backend/api/Database/Models/MissionTask.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,7 @@ or TaskStatus.Failed
137137

138138
public void UpdateWithIsarInfo(IsarTask isarTask)
139139
{
140-
if (
141-
isarTask.TaskType != IsarTaskType.ReturnToHome
142-
&& isarTask.TaskType != IsarTaskType.MoveArm
143-
)
140+
if (isarTask.TaskType != IsarTaskType.ReturnToHome)
144141
{
145142
Inspection?.UpdateWithIsarInfo(isarTask);
146143
}

backend/api/MQTT/MessageModels/IsarTask.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public bool IsInspectionTask(string isarTaskType)
4141
"take_thermal_video" => true,
4242
"take_co2_measurement" => true,
4343
"return_to_home" => false,
44-
"move_arm" => false,
4544

4645
_ => throw new ArgumentException($"ISAR Task type '{isarTaskType}' not supported"),
4746
};

backend/api/Services/IsarService.cs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public interface IIsarService
1919

2020
public Task ResumeMission(Robot robot);
2121

22-
public Task<IsarMission> StartMoveArm(Robot robot, string armPosition);
23-
2422
public Task<MediaConfig?> GetMediaStreamConfig(Robot robot);
2523

2624
public Task ReleaseInterventionNeeded(string robotIsarUri);
@@ -239,46 +237,6 @@ public async Task ResumeMission(Robot robot)
239237
}
240238
}
241239

242-
public async Task<IsarMission> StartMoveArm(Robot robot, string armPosition)
243-
{
244-
string armPositionPath = $"schedule/move_arm/{armPosition}";
245-
var response = await CallApi(HttpMethod.Post, robot.IsarUri, armPositionPath);
246-
247-
if (!response.IsSuccessStatusCode)
248-
{
249-
(string message, int statusCode) = GetErrorDescriptionForFailedIsarRequest(
250-
response
251-
);
252-
string errorResponse = await response.Content.ReadAsStringAsync();
253-
logger.LogError("{Message}: {ErrorResponse}", message, errorResponse);
254-
throw new MissionArmPositionException(message, statusCode);
255-
}
256-
if (response.Content is null)
257-
{
258-
string errorMessage = "Could not read content from start move arm";
259-
logger.LogError("{ErrorMessage}", errorMessage);
260-
throw new MissionArmPositionException(errorMessage);
261-
}
262-
263-
var isarMissionResponse =
264-
await response.Content.ReadFromJsonAsync<IsarStartMissionResponse>();
265-
if (isarMissionResponse is null)
266-
{
267-
string errorMessage = $"Failed to move arm to '{armPosition}' from ISAR";
268-
logger.LogError("{ErrorMessage}", errorMessage);
269-
throw new JsonException(errorMessage);
270-
}
271-
272-
var isarMission = new IsarMission(isarMissionResponse);
273-
274-
logger.LogInformation(
275-
"ISAR move arm to '{ArmPosition}' started on robot '{RobotId}'",
276-
armPosition,
277-
robot.Id
278-
);
279-
return isarMission;
280-
}
281-
282240
public async Task ReleaseInterventionNeeded(string robotIsarUri)
283241
{
284242
HttpResponseMessage? response;

backend/api/Services/Models/IsarTask.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public static IsarTaskType TaskTypeFromString(string isarClassName)
3838
"take_thermal_video" => IsarTaskType.TakeThermalVideo,
3939
"take_co2_measurement" => IsarTaskType.TakeCO2Measurement,
4040
"return_to_home" => IsarTaskType.ReturnToHome,
41-
"move_arm" => IsarTaskType.MoveArm,
4241
_ => throw new ArgumentException(
4342
$"Failed to parse step type '{isarClassName}' - not supported"
4443
),
@@ -66,6 +65,5 @@ public enum IsarTaskType
6665
TakeThermalVideo,
6766
TakeCO2Measurement,
6867
RecordAudio,
69-
MoveArm,
7068
}
7169
}

backend/api/Utilities/Exceptions.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,6 @@ public MissionResumeException(string message, int isarStatusCode)
5858
public int IsarStatusCode { get; set; }
5959
}
6060

61-
public class MissionArmPositionException : Exception
62-
{
63-
public MissionArmPositionException(string message)
64-
: base(message) { }
65-
66-
public MissionArmPositionException(string message, int isarStatusCode)
67-
: base(message)
68-
{
69-
IsarStatusCode = isarStatusCode;
70-
}
71-
72-
public int IsarStatusCode { get; set; }
73-
}
74-
7561
public class MissionLoaderUnavailableException(string message) : Exception(message) { }
7662

7763
public class SourceException(string message) : Exception(message) { }

frontend/src/api/ApiCaller.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,6 @@ export class BackendAPICaller {
287287
return result.content
288288
}
289289

290-
static async setArmPosition(robotId: string, armPosition: string): Promise<void> {
291-
const path: string = `robots/${robotId}/SetArmPosition/${armPosition}`
292-
await BackendAPICaller.PUT(path).catch(BackendAPICaller.handleError('PUT', path))
293-
}
294-
295290
static async deleteMission(missionId: string) {
296291
const path: string = 'missions/runs/' + missionId
297292
return await BackendAPICaller.DELETE(path, '').catch(BackendAPICaller.handleError('DELETE', path))

frontend/src/components/Pages/RobotPage/RobotArmMovement.tsx

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)