aron_conversions.cpp
Go to the documentation of this file.
1#include "aron_conversions.h"
2
6
7namespace 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
118namespace armarx::armem
119{
120
121 void
122 clazz::fromAron(const arondto::Feature& dto, Feature& bo)
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
132 clazz::toAron(arondto::Feature& dto, const Feature& bo)
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}
std::string str() const
Return "dataset/className" or "dataset/className/instanceName".
Definition ObjectID.cpp:60
MemoryID withProviderSegmentName(const std::string &name) const
Definition MemoryID.cpp:417
MemoryID withEntityName(const std::string &name) const
Definition MemoryID.cpp:425
MemoryID withTimestamp(Time time) const
Definition MemoryID.cpp:433
FramedPose getGlobalMarkerPose() const
Definition types.cpp:61
void toAron(armarx::armem::arondto::Feature &dto, const Feature &bo)
void fromAron(const armarx::armem::arondto::Feature &dto, Feature &bo)
MemoryID makeObjectInstanceMemoryID(const objpose::ObjectPose &objectPose)
Make a Memory ID for the object instance snapshot representing this pose.
void fromAron(const arondto::MemoryID &dto, MemoryID &bo)
void toAron(arondto::MemoryID &dto, const MemoryID &bo)
void fromAron(const T &dto, T &bo)
void toAron(T &dto, const T &bo)
Framework for converting ARON DTOs (Data Transfer Objects) to C++ BOs (Business Objects) and back.
void toAron(arondto::ObjectAttachmentInfo &dto, const ObjectAttachmentInfo &bo)
Definition objpose.cpp:21
void fromAron(const arondto::ObjectAttachmentInfo &dto, ObjectAttachmentInfo &bo)
Definition objpose.cpp:13
This file offers overloads of toIce() and fromIce() functions for STL container types.
void toAron(arondto::PackagePath &dto, const PackageFileLocation &bo)
void fromAron(const arondto::PackagePath &dto, PackageFileLocation &bo)
AgentID id
id either pointing to a arondto::Robot or arondto::ArticulatedObject
Definition types.h:87
ArticulatedObjectAttachment describes a fixed transformation between an agent and an articulated obje...
Definition types.h:122
ObjectAttachment describes a fixed transformation between an agent and an object.
Definition types.h:101
An object pose as stored by the ObjectPoseStorage.
Definition ObjectPose.h:34
armarx::ObjectID objectID
The object ID, i.e. dataset, class name and instance name.
Definition ObjectPose.h:56
std::string providerName
Name of the providing component.
Definition ObjectPose.h:59
DateTime timestamp
Source timestamp.
Definition ObjectPose.h:98