aron_conversions.cpp
Go to the documentation of this file.
1 #include "aron_conversions.h"
2 
6 
7 namespace armarx
8 {
9 
10  void
11  armem::fromAron(const arondto::ObjectInstance& dto, objpose::arondto::ObjectPose& bo)
12  {
13  bo = dto.pose;
14  }
15 
16  void
17  armem::toAron(arondto::ObjectInstance& dto, const objpose::arondto::ObjectPose& bo)
18  {
19  dto.pose = bo;
20  }
21 
22  void
23  armem::fromAron(const arondto::ObjectInstance& dto, objpose::ObjectPose& bo)
24  {
25  objpose::fromAron(dto.pose, bo);
26  }
27 
28  void
29  armem::toAron(arondto::ObjectInstance& dto, const objpose::ObjectPose& bo)
30  {
31  objpose::toAron(dto.pose, bo);
32  }
33 
34  /* Attachments */
35  void
36  armem::fromAron(const arondto::attachment::AgentDescription& dto,
38  {
39  fromAron(dto.id, bo.id);
40  aron::fromAron(dto.frame, bo.frame);
41  }
42 
43  void
44  armem::toAron(arondto::attachment::AgentDescription& dto,
46  {
47  toAron(dto.id, bo.id);
48  aron::toAron(dto.frame, bo.frame);
49  }
50 
51  void
52  armem::fromAron(const arondto::attachment::ObjectAttachment& dto,
54  {
55  fromAron(dto.agent, bo.agent);
56  aron::fromAron(dto.transformation, bo.transformation);
57  fromAron(dto.object, bo.object);
58  aron::fromAron(dto.active, bo.active);
59  // TODO aron::fromAron(dto.timestamp, bo.timestamp);
60  }
61 
62  void
63  armem::toAron(arondto::attachment::ObjectAttachment& dto,
65  {
66  toAron(dto.agent, bo.agent);
67  aron::toAron(dto.transformation, bo.transformation);
68  toAron(dto.object, bo.object);
69  aron::toAron(dto.active, bo.active);
70  // TODO aron::toAron(dto.timestamp, bo.timestamp);
71  }
72 
73  void
74  armem::fromAron(const arondto::attachment::ArticulatedObjectAttachment& dto,
76  {
77  fromAron(dto.agent, bo.agent);
78  aron::fromAron(dto.transformation, bo.transformation);
79  fromAron(dto.object, bo.object);
80  aron::fromAron(dto.active, bo.active);
81  // TODO aron::fromAron(dto.timestamp, bo.timestamp);
82  }
83 
84  void
85  armem::toAron(arondto::attachment::ArticulatedObjectAttachment& dto,
87  {
88  toAron(dto.agent, bo.agent);
89  aron::toAron(dto.transformation, bo.transformation);
90  toAron(dto.object, bo.object);
91  aron::toAron(dto.active, bo.active);
92  // TODO aron::toAron(dto.timestamp, bo.timestamp);
93  }
94 
95  void
96  armem::toAron(arondto::Marker& dto, const marker::Marker& bo)
97  {
98  dto.name = bo.name;
99  armarx::toAron(dto.robotGlobal, bo.robotGlobal);
100  armarx::toAron(dto.rgbCamera, bo.rgbCamera);
101  armarx::toAron(dto.depthCamera, bo.depthCamera);
102  armarx::toAron(dto.markerPose, bo.markerPose);
103  armarx::toAron(dto.markerGlobal, bo.getGlobalMarkerPose());
104  }
105 
106  void
107  armem::fromAron(const arondto::Marker& dto, marker::Marker& bo)
108  {
109  bo.name = dto.name;
110  armarx::fromAron(dto.robotGlobal, bo.robotGlobal);
111  armarx::fromAron(dto.rgbCamera, bo.rgbCamera);
112  armarx::fromAron(dto.depthCamera, bo.depthCamera);
113  armarx::fromAron(dto.markerPose, bo.markerPose);
114  }
115 
116 } // namespace armarx
117 
118 namespace armarx::armem
119 {
120 
121  void
123  {
124  bo.angle = dto.angle;
125  bo.scale = dto.scale;
126  bo.feature = dto.feature;
127  bo.point2d = dto.point2d;
128  bo.point3d = dto.point3d;
129  }
130 
131  void
133  {
134  dto.angle = bo.angle;
135  dto.scale = bo.scale;
136  dto.feature = bo.feature;
137  dto.point2d = bo.point2d;
138  dto.point3d = bo.point3d;
139  }
140 
141  void
142  clazz::fromAron(const arondto::ObjectClass& dto, ObjectClass& bo)
143  {
144  armarx::fromAron(dto.id, bo.id);
145  armarx::fromAron(dto.simoxXmlPath, bo.simoxXmlPath);
146  armarx::fromAron(dto.articulatedSimoxXmlPath, bo.articulatedSimoxXmlPath);
147  armarx::fromAron(dto.urdfPath, bo.urdfPath);
148  armarx::fromAron(dto.articulatedUrdfPath, bo.articulatedUrdfPath);
149  armarx::fromAron(dto.sdfPath, bo.sdfPath);
150  armarx::fromAron(dto.meshWrlPath, bo.meshWrlPath);
151  armarx::fromAron(dto.meshObjPath, bo.meshObjPath);
152  armarx::fromAron(dto.aabb, bo.aabb);
153  armarx::fromAron(dto.oobb, bo.oobb);
154  fromAron(dto.names, bo.names);
155  bo.ivtFeatures.clear();
156  for (const auto& i : dto.ivtFeatures)
157  {
158  fromAron(i, bo.ivtFeatures.emplace_back());
159  }
160  }
161 
162  void
163  clazz::toAron(arondto::ObjectClass& dto, const ObjectClass& bo)
164  {
165  armarx::toAron(dto.id, bo.id);
166  armarx::toAron(dto.simoxXmlPath, bo.simoxXmlPath);
167  armarx::toAron(dto.articulatedSimoxXmlPath, bo.articulatedSimoxXmlPath);
168  armarx::toAron(dto.urdfPath, bo.urdfPath);
169  armarx::toAron(dto.articulatedUrdfPath, bo.articulatedUrdfPath);
170  armarx::toAron(dto.sdfPath, bo.sdfPath);
171  armarx::toAron(dto.meshWrlPath, bo.meshWrlPath);
172  armarx::toAron(dto.meshObjPath, bo.meshObjPath);
173  armarx::toAron(dto.aabb, bo.aabb);
174  armarx::toAron(dto.oobb, bo.oobb);
175  toAron(dto.names, bo.names);
176  dto.ivtFeatures.clear();
177  for (const auto& i : bo.ivtFeatures)
178  {
179  toAron(dto.ivtFeatures.emplace_back(), i);
180  }
181  }
182 
183 } // namespace armarx::armem
184 
187 {
188  return MemoryID("Object/Instance")
190  .withEntityName(objectPose.objectID.str())
191  .withTimestamp(objectPose.timestamp);
192 }
Feature
Definition: Feature.hpp:44
armarx::armem::attachment::ObjectAttachment
ObjectAttachment describes a fixed transformation between an agent and an object.
Definition: types.h:100
armarx::armem::marker::Marker
Definition: types.h:146
armarx::armem::attachment::AgentDescription
Definition: types.h:81
armarx::armem::toAron
void toAron(arondto::MemoryID &dto, const MemoryID &bo)
Definition: aron_conversions.cpp:19
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
armarx::objpose::ObjectPose::providerName
std::string providerName
Name of the providing component.
Definition: ObjectPose.h:61
armarx::armem::MemoryID::withProviderSegmentName
MemoryID withProviderSegmentName(const std::string &name) const
Definition: MemoryID.cpp:412
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::Feature
@ Feature
Definition: OpticalFlow.h:53
armarx::armem::attachment::ArticulatedObjectAttachment
ArticulatedObjectAttachment describes a fixed transformation between an agent and an articulated obje...
Definition: types.h:121
armarx::objpose::toAron
void toAron(arondto::ObjectAttachmentInfo &dto, const ObjectAttachmentInfo &bo)
Definition: objpose.cpp:22
aron_conversions.h
aron_conversions.h
armarx::armem::clazz::toAron
void toAron(armarx::armem::arondto::Feature &dto, const Feature &bo)
armarx::armem::fromAron
void fromAron(const arondto::MemoryID &dto, MemoryID &bo)
Definition: aron_conversions.cpp:8
armarx::objpose::ObjectPose::objectID
armarx::ObjectID objectID
The object ID, i.e. dataset, class name and instance name.
Definition: ObjectPose.h:58
armarx::objpose::fromAron
void fromAron(const arondto::ObjectAttachmentInfo &dto, ObjectAttachmentInfo &bo)
Definition: objpose.cpp:15
armarx::armem::MemoryID::withEntityName
MemoryID withEntityName(const std::string &name) const
Definition: MemoryID.cpp:420
armarx::aron::toAron
void toAron(T &dto, const T &bo)
Framework for converting ARON DTOs (Data Transfer Objects) to C++ BOs (Business Objects) and back.
Definition: aron_conversions.h:74
armarx::fromAron
void fromAron(const arondto::PackagePath &dto, PackageFileLocation &bo)
armarx::armem::MemoryID::withTimestamp
MemoryID withTimestamp(Time time) const
Definition: MemoryID.cpp:428
armarx::armem::clazz::fromAron
void fromAron(const armarx::armem::arondto::Feature &dto, Feature &bo)
armarx::toAron
void toAron(arondto::PackagePath &dto, const PackageFileLocation &bo)
armarx::aron::fromAron
void fromAron(const T &dto, T &bo)
Definition: aron_conversions.h:79
armarx::armem::obj::makeObjectInstanceMemoryID
MemoryID makeObjectInstanceMemoryID(const objpose::ObjectPose &objectPose)
Make a Memory ID for the object instance snapshot representing this pose.
Definition: aron_conversions.cpp:186
aron_conversions.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::objpose::ObjectPose
An object pose as stored by the ObjectPoseStorage.
Definition: ObjectPose.h:36
armarx::aron::bo
const std::optional< BoT > & bo
Definition: aron_conversions.h:168
armarx::ObjectID::str
std::string str() const
Return "dataset/className" or "dataset/className/instanceName".
Definition: ObjectID.cpp:55
armarx::objpose::ObjectPose::timestamp
DateTime timestamp
Source timestamp.
Definition: ObjectPose.h:100
armarx::human::MemoryID
const armem::MemoryID MemoryID
Definition: memory_ids.cpp:29