Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use target and pose directly from Echo request #1057

Merged
merged 9 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions backend/api.test/Client/AreaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,23 @@ public async Task GetMissionsInAreaTest()

var inspections = new List<CustomInspectionQuery>
{
new() { AnalysisType = AnalysisType.CarSeal, InspectionType = InspectionType.Image}
new()
{
AnalysisType = AnalysisType.CarSeal,
InspectionTarget = new Position(),
InspectionType = InspectionType.Image
}
};
var tasks = new List<CustomTaskQuery>
{
new() { Inspections = inspections, InspectionTarget = new Position(), TagId = "test", RobotPose = new Pose(), TaskOrder = 0}
new()
{
Inspections = inspections,
InspectionTarget = new Position(),
TagId = "test",
RobotPose = new Pose(),
TaskOrder = 0
}
};
var missionQuery = new CustomMissionQuery
{
Expand Down
18 changes: 9 additions & 9 deletions backend/api.test/Database/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class TestPose
[Fact]
public void TestRotationNorth()
{
var mockAngleAxisParameters = new EchoVector(0, 0, 1);
var mockAngleAxisParameters = new EnuPosition(0, 0, 1);
float mockAngle = 0;

var expected = new Orientation()
Expand All @@ -31,7 +31,7 @@ public void TestRotationNorth()
[Fact]
public void TestRotationSouth()
{
var mockAngleAxisParameters = new EchoVector(0, 0, 1);
var mockAngleAxisParameters = new EnuPosition(0, 0, 1);
float mockAngle = MathF.PI;

var expected = new Orientation()
Expand All @@ -54,7 +54,7 @@ public void TestRotationSouth()
[Fact]
public void TestNegativaRotation()
{
var mockAngleAxisParameters = new EchoVector(0, 0, 1);
var mockAngleAxisParameters = new EnuPosition(0, 0, 1);
float mockAngle = -180F * MathF.PI / 180F;

var expected = new Orientation()
Expand Down Expand Up @@ -95,7 +95,7 @@ private static EchoPose ConvertPredefinedPoseToEchoPose(
Orientation orientation
)
{
var enuPosition = new EchoVector(position.X, position.Y, position.Z);
var enuPosition = new EnuPosition(position.X, position.Y, position.Z);
var axisAngle = ConvertOrientation(orientation);
return new EchoPose(enuPosition, axisAngle);
}
Expand All @@ -114,15 +114,15 @@ private static AxisAngle ConvertOrientation(Orientation orientation)

if (angle < 0) angle += 2F * MathF.PI;

return new AxisAngle(new EchoVector(0, 0, 1), angle);
return new AxisAngle(new EnuPosition(0, 0, 1), angle);
}

public class AxisAngle
{
public EchoVector Axis;
public EnuPosition Axis;
public float Angle;

public AxisAngle(EchoVector axis, float angle)
public AxisAngle(EnuPosition axis, float angle)
{
Axis = axis;
Angle = angle;
Expand All @@ -131,10 +131,10 @@ public AxisAngle(EchoVector axis, float angle)

public class EchoPose
{
public EchoVector Position;
public EnuPosition Position;
public AxisAngle Orientation;

public EchoPose(EchoVector position, AxisAngle orientation)
public EchoPose(EnuPosition position, AxisAngle orientation)
{
Position = position;
Orientation = orientation;
Expand Down
11 changes: 2 additions & 9 deletions backend/api.test/Mocks/EchoServiceMock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System.Threading.Tasks;
using Api.Controllers.Models;
using Api.Services;
using Api.Services.Models;

namespace Api.Test.Mocks
{
public class MockEchoService : IEchoService
Expand Down Expand Up @@ -38,13 +36,13 @@ public class MockEchoService : IEchoService
new()
{
EchoMissionId = 1,
Name = "test",
Name = "test"
};

public async Task<IList<CondensedEchoMissionDefinition>> GetAvailableMissions(string? installationCode)
{
await Task.Run(() => Thread.Sleep(1));
return new List<CondensedEchoMissionDefinition>(new CondensedEchoMissionDefinition[] { MockMissionDefinition });
return new List<CondensedEchoMissionDefinition>(new[] { MockMissionDefinition });
}

public async Task<EchoMission> GetMissionById(int missionId)
Expand All @@ -58,11 +56,6 @@ public async Task<IList<EchoPlantInfo>> GetEchoPlantInfos()
await Task.Run(() => Thread.Sleep(1));
return _mockEchoPlantInfo;
}
public async Task<EchoPoseResponse> GetRobotPoseFromPoseId(int poseId)
{
await Task.Run(() => Thread.Sleep(1));
return new EchoPoseResponse();
}

public Task<EchoMission> GetMissionByPath(string relativePath)
{
Expand Down
Loading
Loading