Skip to content

Commit

Permalink
Use echo inspection target name as tag description
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Dec 10, 2024
1 parent 4e1ff0c commit ac7aa79
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions backend/api.test/Mocks/MissionLoaderMock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class MockMissionLoader() : IMissionLoader
tagId: "1",
tagLink: new Uri("https://testurl.com"),
poseId: 1,
taskDescription: "description",
robotPose: new Pose
{
Position = new Position { X = 0, Y = 0, Z = 0 },
Expand All @@ -42,6 +43,7 @@ public class MockMissionLoader() : IMissionLoader
tagId: "2",
tagLink: new Uri("https://testurl.com"),
poseId: 1,
taskDescription: "description",
robotPose: new Pose
{
Position = new Position { X = 0, Y = 0, Z = 0 },
Expand Down
7 changes: 7 additions & 0 deletions backend/api/Database/Context/InitDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ private static List<MissionTask> GetMissionTasks()
taskOrder: 0,
tagLink: url,
tagId: "ABCD",
taskDescription: "Task description",
poseId: 2,
status: TaskStatus.Successful
);
Expand All @@ -463,6 +464,7 @@ private static List<MissionTask> GetMissionTasks()
taskOrder: 0,
tagLink: url,
tagId: "ABCDE",
taskDescription: "Task description",
poseId: 2,
status: TaskStatus.Failed
);
Expand All @@ -473,6 +475,7 @@ private static List<MissionTask> GetMissionTasks()
taskOrder: 0,
tagLink: url,
tagId: "ABCDEF",
taskDescription: "Task description",
poseId: 2,
status: TaskStatus.PartiallySuccessful
);
Expand All @@ -483,6 +486,7 @@ private static List<MissionTask> GetMissionTasks()
taskOrder: 0,
tagLink: url,
tagId: "ABCDEFG",
taskDescription: "Task description",
poseId: 2,
status: TaskStatus.Cancelled
);
Expand All @@ -493,6 +497,7 @@ private static List<MissionTask> GetMissionTasks()
taskOrder: 0,
tagLink: url,
tagId: "ABCDEFGH",
taskDescription: "Task description",
poseId: 2,
status: TaskStatus.Failed
);
Expand All @@ -503,6 +508,7 @@ private static List<MissionTask> GetMissionTasks()
taskOrder: 0,
tagLink: url,
tagId: "ABCDEFGHI",
taskDescription: "Task description",
poseId: 2,
status: TaskStatus.Failed
);
Expand All @@ -513,6 +519,7 @@ private static List<MissionTask> GetMissionTasks()
taskOrder: 0,
tagLink: url,
tagId: "ABCDEFGHIJ",
taskDescription: "Task description",
poseId: 2,
status: TaskStatus.Failed
);
Expand Down
4 changes: 4 additions & 0 deletions backend/api/Database/Models/Inspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ public Inspection(
InspectionType inspectionType,
float? videoDuration,
Position inspectionTarget,
string? inspectionTargetName,
InspectionStatus status = InspectionStatus.NotStarted,
AnalysisType? analysisType = null
)
{
InspectionType = inspectionType;
VideoDuration = videoDuration;
InspectionTarget = inspectionTarget;
InspectionTargetName = inspectionTargetName;
AnalysisType = analysisType;
Status = status;
}
Expand Down Expand Up @@ -65,6 +67,8 @@ public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null, bo
[Required]
public Position InspectionTarget { get; set; }

public string? InspectionTargetName { get; set; }

[Required]
public InspectionStatus Status
{
Expand Down
2 changes: 2 additions & 0 deletions backend/api/Database/Models/MissionTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public MissionTask(
Uri? tagLink,
string? tagId,
int? poseId,
string? taskDescription,
TaskStatus status = TaskStatus.NotStarted,
MissionTaskType type = MissionTaskType.Inspection)
{
Expand All @@ -33,6 +34,7 @@ public MissionTask(
RobotPose = robotPose;
PoseId = poseId;
TaskOrder = taskOrder;
Description = taskDescription;
Status = status;
Type = type;
if (inspection != null) Inspection = new Inspection(inspection);
Expand Down
6 changes: 4 additions & 2 deletions backend/api/Services/EchoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private static List<EchoTag> ProcessPlanItems(List<PlanItem> planItems, string i
$"https://stid.equinor.com/{installationCode}/tag?tagNo={planItem.Tag}"
),
Inspections = planItem.SensorTypes
.Select(sensor => new EchoInspection(sensor, planItem.InspectionPoint.EnuPosition.ToPosition())).Distinct(new EchoInspectionComparer()).ToList()
.Select(sensor => new EchoInspection(sensor, planItem.InspectionPoint.EnuPosition.ToPosition(), planItem.InspectionPoint.Name)).Distinct(new EchoInspectionComparer()).ToList()
};

if (tag.Inspections.Count < 1)
Expand Down Expand Up @@ -275,7 +275,8 @@ public IList<MissionTask> MissionTasksFromEchoTag(EchoTag echoTag)
.Select(inspection => new Inspection(
inspectionType: inspection.InspectionType,
videoDuration: inspection.TimeInSeconds,
inspection.InspectionPoint,
inspectionTarget: inspection.InspectionPoint,
inspectionTargetName: inspection.InspectionPointName,
status: InspectionStatus.NotStarted))
.ToList();

Expand All @@ -292,6 +293,7 @@ public IList<MissionTask> MissionTasksFromEchoTag(EchoTag echoTag)
robotPose: echoTag.Pose,
poseId: echoTag.PoseId,
taskOrder: echoTag.PlanOrder,
taskDescription: inspection.InspectionTargetName,
status: Database.Models.TaskStatus.NotStarted,
type: MissionTaskType.Inspection
));
Expand Down
5 changes: 4 additions & 1 deletion backend/api/Services/MissionLoaders/EchoInspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ public EchoInspection()
InspectionPoint = new Position();
}

public EchoInspection(SensorType echoSensorType, Position inspectionPoint)
public EchoInspection(SensorType echoSensorType, Position inspectionPoint, string? inspectionPointName)
{
InspectionType = InspectionTypeFromEchoSensorType(echoSensorType.Key);
TimeInSeconds = (float?)echoSensorType.TimeInSeconds;
InspectionPoint = inspectionPoint;
InspectionPointName = inspectionPointName != "Stid Coordinate" ? inspectionPointName : null;
}

public InspectionType InspectionType { get; set; }

public Position InspectionPoint { get; set; }

public string? InspectionPointName { get; set; }

public float? TimeInSeconds { get; set; }

private static InspectionType InspectionTypeFromEchoSensorType(string sensorType)
Expand Down

0 comments on commit ac7aa79

Please sign in to comment.