Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • arf/world-storage-api-helpers/world-storage-asp.net-server
1 result
Show changes
Commits on Source (2)
openapi @ 61f9f881
Subproject commit c60cee2a1a6afb98c7e6364bf81700d948d5cefa
Subproject commit 61f9f881fd6e4df80767f35107ae36750b307395
......@@ -55,6 +55,7 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers
public override IActionResult GetRelocalizationInformation([FromQuery(Name = "uuids")][Required()] List<GetRelocalizationInformationUuidsParameterInner> uuids, [FromQuery(Name = "capabilities")][Required()] List<Capability> capabilities, [FromHeader(Name = "token")] string token)
{
WorldAnchorService _worldAnchorService = WorldAnchorService.Singleton as WorldAnchorService;
TrackableService _trackableService = TrackableService.Singleton as TrackableService;
var history = new List<Guid>();
var result = new GetRelocalizationInformation200Response();
......@@ -63,6 +64,13 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers
foreach (var request in uuids)
{
var anchor = _worldAnchorService.Get(request.Uuid);
Trackable trackable = null;
if (anchor == null)
{
// anchor not found, try to find uuid as a trackable
trackable = _trackableService.Get(request.Uuid);
}
if (anchor != null)
{
......@@ -72,10 +80,42 @@ namespace ETSI.ARF.OpenAPI.WorldStorage.Controllers
var relocalizationInformation = new RelocalizationInformation();
relocalizationInformation.RequestUUID = anchor.UUID;
relocalizationInformation.RequestType = TypeWorldStorage.ANCHOREnum;
relocalizationInformation.RelocObjects = FindRelocInfo(anchor.UUID, request.Mode, matrix, capabilities, ref history);
result.RelocInfo.Add(relocalizationInformation);
}
else if (trackable != null)
{
history.Add(trackable.UUID);
Matrix4x4 matrix = Matrix4x4.Identity;
var relocalizationInformation = new RelocalizationInformation();
relocalizationInformation.RequestUUID = trackable.UUID;
relocalizationInformation.RequestType = TypeWorldStorage.TRACKABLEEnum;
relocalizationInformation.RelocObjects = new List<RelocalizationInformationRelocObjectsInner>();
if (trackable.Match(capabilities))
{
// add itself with matrix identity as Transform3D
var itself = new RelocalizationInformationRelocObjectsInner();
itself.Trackable = trackable;
itself.Mode = request.Mode;
itself.Transform3D = new List<float>()
{
matrix.M11, matrix.M12, matrix.M13, matrix.M14,
matrix.M21, matrix.M22, matrix.M23, matrix.M24,
matrix.M31, matrix.M32, matrix.M33, matrix.M34,
matrix.M41, matrix.M42, matrix.M43, matrix.M44,
};
relocalizationInformation.RelocObjects.Add(itself);
}
relocalizationInformation.RelocObjects.AddRange(FindRelocInfo(trackable.UUID, request.Mode, matrix, capabilities, ref history));
result.RelocInfo.Add(relocalizationInformation);
}
else
{
Console.WriteLine($"WorldAnchor with UUID {request.Uuid} does not exist in database");
......