5 #include <RobotAPI/libraries/GraspingUtility/aron/GraspCandidate.aron.generated.h>
21 ARMARX_IMPORTANT <<
"GraspCandidateReader: Waiting for memory '" << properties.memoryName
25 memoryReader =
use ? memoryNameSystem.
useReader(properties.memoryName)
28 << properties.memoryName;
37 armarx::grasping::GraspCandidate
40 armarx::grasping::GraspCandidate candidate;
42 grasping::arondto::GraspCandidate aronTransform;
44 aronTransform.fromAron(instance.
data());
51 armarx::grasping::BimanualGraspCandidate
54 armarx::grasping::BimanualGraspCandidate candidate;
56 grasping::arondto::BimanualGraspCandidate aronTransform;
57 aronTransform.fromAron(instance.
data());
64 grasping::GraspCandidatePtr
68 if (
auto it = dict.find(
id.str()); it != dict.end())
78 grasping::GraspCandidateDict
83 ARMARX_DEBUG <<
"Query for memory name: " << properties.memoryName;
95 armarx::grasping::GraspCandidateDict candidates;
100 candidates[
id.str()] =
new grasping::GraspCandidate(
asGraspCandidate(*instance));
107 grasping::BimanualGraspCandidatePtr
112 ARMARX_DEBUG <<
"Query for memory name: " << properties.memoryName;
125 armarx::grasping::BimanualGraspCandidatePtr candidate;
130 if (instance.id() == id)
143 grasping::GraspCandidateDict
145 const std::string& entity)
const
149 ARMARX_DEBUG <<
"Query for memory name: " << properties.memoryName;
152 .
withName(properties.graspCandidateMemoryName)
162 return getGraspCandidatesFromResultSet(qResult);
165 std::map<std::string, grasping::BimanualGraspCandidatePtr>
167 const std::string& entity)
const
171 ARMARX_DEBUG <<
"Query for memory name: " << properties.memoryName;
174 .
withName(properties.bimanualGraspCandidateMemoryName)
184 return getBimanualGraspCandidatesFromResultSet(qResult);
187 grasping::GraspCandidateDict
193 ARMARX_DEBUG <<
"Query for memory name: " << properties.memoryName;
196 if (!provider.empty())
199 .
withName(properties.graspCandidateMemoryName)
210 .
withName(properties.graspCandidateMemoryName)
221 return getGraspCandidatesFromResultSet(qResult);
224 std::map<std::string, grasping::BimanualGraspCandidatePtr>
229 ARMARX_DEBUG <<
"Query for memory name: " << properties.memoryName;
232 if (!provider.empty())
235 .
withName(properties.bimanualGraspCandidateMemoryName)
246 .
withName(properties.bimanualGraspCandidateMemoryName)
257 return getBimanualGraspCandidatesFromResultSet(qResult);
263 ARMARX_DEBUG <<
"GraspCandidateReader: registerPropertyDefinitions";
265 const std::string prefix = propertyPrefix;
267 def->optional(properties.graspCandidateMemoryName,
268 prefix +
"GraspCandidateMemoryName",
269 "Name of the grasping memory core segment to use.");
271 def->optional(properties.memoryName, prefix +
"MemoryName");
274 grasping::GraspCandidateDict
275 GraspCandidateReader::getGraspCandidatesFromResultSet(
284 std::map<std::string, armarx::grasping::GraspCandidatePtr> candidates;
289 candidates[instance.id().str()] =
300 std::map<std::string, grasping::BimanualGraspCandidatePtr>
301 GraspCandidateReader::getBimanualGraspCandidatesFromResultSet(
302 const armem::client::QueryResult& qResult)
const
304 if (!qResult.success)
306 throw armem::error::QueryFailed(properties.memoryName, qResult.errorMessage);
310 std::map<std::string, armarx::grasping::BimanualGraspCandidatePtr> candidates;
312 armem::wm::FunctionalVisitor visitor;
315 candidates[instance.id().str()] =
320 visitor.applyTo(qResult.memory);
326 grasping::GraspCandidateDict
332 ARMARX_DEBUG <<
"Query for memory name: " << properties.memoryName;
335 if (!provider.empty())
338 .
withName(properties.graspCandidateMemoryName)
349 .
withName(properties.graspCandidateMemoryName)
359 return getGraspCandidatesFromResultSet(qResult);