Skip to content
Snippets Groups Projects
Commit aa747fb9 authored by Fabian Reister's avatar Fabian Reister
Browse files

aron_conversions: fixes due to aron enum now being enum class

parent 002afdf4
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,9 @@
#include <SimoxUtility/shapes/OrientedBox.h>
// RobotAPI
// TODO: ice dependency! header should be removed.
#include <RobotAPI/interface/objectpose/object_pose_types.h>
#include <RobotAPI/libraries/ArmarXObjects/ObjectPose.h>
#include <RobotAPI/libraries/ArmarXObjects/aron/ObjectPose.aron.generated.h>
......@@ -24,19 +26,20 @@ namespace armarx::objpose
return ObjectID(id.dataset, id.className, id.instanceName);
}
ObjectTypeEnum fromAron(const aron::ObjectTypeEnum& objectType)
ObjectTypeEnum fromAron(const aron::ObjectTypes& objectType)
{
using AronObjectType = aron::ObjectTypes::__ImplEnum;
switch (objectType.value)
{
case aron::ObjectTypeEnum::ANY_OBJECT:
case AronObjectType::ANY_OBJECT:
return ObjectTypeEnum::AnyObject;
case aron::ObjectTypeEnum::KNOWN_OBJECT:
case AronObjectType::KNOWN_OBJECT:
return ObjectTypeEnum::KnownObject;
case aron::ObjectTypeEnum::UNKNOWN_OBJECT:
case AronObjectType::UNKNOWN_OBJECT:
return ObjectTypeEnum::UnknownObject;
default:
// TODO(fabian.reister): do it the ARMARX way ...
throw std::invalid_argument("Invalid ObjectTypeEnum value: " + std::to_string(objectType.value));
throw std::invalid_argument("Invalid aron::ObjectTypes value: " + std::to_string(objectType));
}
}
......@@ -76,7 +79,6 @@ namespace armarx::objpose
objectPose.confidence = aronObjectPose.confidence;
// TODO(fabian.reister): check if micro seconds is correct
objectPose.timestamp = IceUtil::Time::microSeconds(aronObjectPose.timestamp);
objectPose.localOOBB = fromAron(aronObjectPose.localOOBB);
......@@ -93,16 +95,16 @@ namespace armarx::objpose
return aronId;
}
decltype(aron::ObjectTypeEnum::value) toAronValue(const ObjectTypeEnum& objectType)
aron::ObjectTypes toAron(const ObjectTypeEnum& objectType)
{
switch (objectType)
{
case ObjectTypeEnum::AnyObject:
return aron::ObjectTypeEnum::ANY_OBJECT;
return aron::ObjectTypes::ANY_OBJECT;
case ObjectTypeEnum::KnownObject:
return aron::ObjectTypeEnum::KNOWN_OBJECT;
return aron::ObjectTypes::KNOWN_OBJECT;
case ObjectTypeEnum::UnknownObject:
return aron::ObjectTypeEnum::UNKNOWN_OBJECT;
return aron::ObjectTypes::UNKNOWN_OBJECT;
default:
// TODO(fabian.reister): do it the ARMARX way ...
throw std::invalid_argument("Invalid ObjectTypeEnum value: " + std::to_string(objectType));
......@@ -144,7 +146,8 @@ namespace armarx::objpose
{
aronObjectPose.providerName = objectPose.providerName;
aronObjectPose.objectType.value = toAronValue(objectPose.objectType);
// TODO(fabian.reister): remove .value
aronObjectPose.objectType.value = toAron(objectPose.objectType).value;
aronObjectPose.objectID = toAron(objectPose.objectID);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment