KnownGraspProviderSegment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <filesystem>
4 #include <optional>
5 
7 
12 #include <RobotAPI/libraries/armem_grasping/aron/KnownGraspCandidate.aron.generated.h>
13 
15 {
17  {
19 
20  public:
22 
23  void init() override;
24 
25  private:
26  void loadMemory();
27  std::optional<arondto::KnownGraspInfo> knownGraspInfoFromObjectInfo(const ObjectInfo&);
28 
29  struct GraspFileInfo
30  {
31  PackageFileLocation fileLocInfo;
32  ObjectID objectId;
33 
34  static GraspFileInfo FromObjectInfo(const ObjectInfo& objectInfo)
35  {
36  const std::string objectClassName = objectInfo.className();
37  PackageFileLocation fileLocInfo = objectInfo.file(".xml", "_Grasps");
38 
39  return GraspFileInfo{.fileLocInfo = fileLocInfo, .objectId = objectInfo.id()};
40  }
41  };
42 
43  std::optional<arondto::KnownGraspInfo>
44  knownGraspInfoFromFile(const GraspFileInfo& graspFileInfo);
45 
46  void installFileWatcher();
47 
48  SimpleRunningTask<>::pointer_type fileWatcherTask;
49 
50  public:
51  static const constexpr char* CORE_SEGMENT_NAME = "KnownGraspCandidate";
52  static const constexpr char* PROVIDER_SEGMENT_NAME = "PriorKnowledgeData";
53 
54  private:
55  static const constexpr char* PREPOSE_SUFFIX = "_Prepose";
56  static const constexpr char* GRASP_OPTIONAL_SUFFIX = "_Grasp";
57  };
58 } // namespace armarx::armem::grasping::segment
armarx::ObjectID
A known object ID of the form "Dataset/ClassName" or "Dataset/ClassName/InstanceName".
Definition: ObjectID.h:10
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition: MemoryToIceAdapter.h:19
armarx::ObjectInfo::className
std::string className() const
Definition: ObjectInfo.cpp:61
armarx::armem::server::segment::SpecializedProviderSegment
A base class for provider segments.
Definition: SpecializedProviderSegment.h:19
armarx::PackageFileLocation
Definition: ObjectInfo.h:22
armarx::armem::grasping::segment::KnownGraspProviderSegment::KnownGraspProviderSegment
KnownGraspProviderSegment(armem::server::MemoryToIceAdapter &iceMemory)
Definition: KnownGraspProviderSegment.cpp:41
armarx::ObjectInfo::file
PackageFileLocation file(const std::string &extension, const std::string &suffix="", bool fixDataPath=false) const
Definition: ObjectInfo.cpp:90
armarx::armem::server::segment::detail::SegmentBase< server::wm::ProviderSegment >
ObjectID.h
ObjectInfo.h
TaskUtil.h
armarx::armem::grasping::segment::KnownGraspProviderSegment::init
void init() override
Definition: KnownGraspProviderSegment.cpp:48
armarx::armem::grasping::segment
Definition: KnownGraspProviderSegment.cpp:38
armarx::armem::server::segment::detail::SegmentBase< server::wm::ProviderSegment >::iceMemory
MemoryToIceAdapter & iceMemory
Definition: SpecializedSegment.h:58
forward_declarations.h
armarx::armem::grasping::segment::KnownGraspProviderSegment::CORE_SEGMENT_NAME
static const constexpr char * CORE_SEGMENT_NAME
Definition: KnownGraspProviderSegment.h:51
IceUtil::Handle
Definition: forward_declarations.h:30
armarx::ObjectInfo::id
ObjectID id() const
Return "dataset/name".
Definition: ObjectInfo.cpp:67
SpecializedProviderSegment.h
armarx::armem::grasping::segment::KnownGraspProviderSegment
Definition: KnownGraspProviderSegment.h:16
armarx::ObjectInfo
Accessor for the object files.
Definition: ObjectInfo.h:36
armarx::armem::grasping::segment::KnownGraspProviderSegment::PROVIDER_SEGMENT_NAME
static const constexpr char * PROVIDER_SEGMENT_NAME
Definition: KnownGraspProviderSegment.h:52