ObjectReader.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @author Fabian Reister ( fabian dot reister at kit dot edu )
17 * @date 2021
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
24#include <optional>
25
27
28#include <RobotAPI/interface/objectpose/FamiliarObjectPoseStorageInterface.h>
31#include <RobotAPI/libraries/armem_objects/aron/FamiliarObjectInstance.aron.generated.h>
32#include <RobotAPI/libraries/armem_objects/aron/ObjectInstance.aron.generated.h>
34
35// The object pose provider. As long as the provider is not connected to armem we need the second proxy
36#include <RobotAPI/interface/objectpose/ObjectPoseProvider.h>
37#include <RobotAPI/interface/objectpose/ObjectPoseStorageInterface.h>
38
40{
41 class Reader
42 {
43 public:
44 // using StoragePrxType = objpose::FamiliarObjectPoseStorageInterfacePrx;
45
47 {
48 std::string memoryName = "Object";
49 };
50
51 Reader() = default;
52 virtual ~Reader() = default;
53
55 void connect(armem::client::MemoryNameSystem& memoryNameSystem);
56
57 // query existing instance from the memory. Requires an instance index to be set.
58 std::optional<std::map<std::string, arondto::FamiliarObjectInstance>>
60 const ObjectID& instanceId,
61 const std::optional<std::string>& providerName = std::nullopt) const;
62
63 // query the latest instances. Ignores the instance index.
64 std::map<std::string, std::vector<arondto::FamiliarObjectInstance>>
66 const std::optional<std::string>& providerName = std::nullopt) const;
67
68 // query all latest object instances.
69 std::map<std::string, std::vector<arondto::FamiliarObjectInstance>>
71 const ObjectID& classId,
72 const std::optional<std::string>& providerName = std::nullopt) const;
73
76 {
77 return this->p;
78 }
79
80 // StoragePrxType
81 // getFamiliarObjectPoseStorage() const
82 // {
83 // return famObjPosStorage;
84 // }
85
86 private:
87 Properties p;
88
89 const std::string propertyPrefix = "mem.obj.familiar_object_instance.";
90
91 armem::client::Reader memoryReader;
92
93
94 // StoragePrxType famObjPosStorage;
95 };
96
97
98} // namespace armarx::armem::obj::familiar_object_instance
A known object ID of the form "Dataset/ClassName" or "Dataset/ClassName/InstanceName".
Definition ObjectID.h:11
The memory name system (MNS) client.
Reads data from a memory server.
Definition Reader.h:25
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
std::map< std::string, std::vector< arondto::FamiliarObjectInstance > > queryLatestFamiliarObjectInstancesFromClass(const ObjectID &classId, const std::optional< std::string > &providerName=std::nullopt) const
std::optional< std::map< std::string, arondto::FamiliarObjectInstance > > queryLatestFamiliarObjectInstance(const ObjectID &instanceId, const std::optional< std::string > &providerName=std::nullopt) const
std::map< std::string, std::vector< arondto::FamiliarObjectInstance > > queryAllLatestFamiliarObjectInstances(const std::optional< std::string > &providerName=std::nullopt) const
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.