@@ -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>
0 commit comments