ObjectMemoryEditor.cpp
Go to the documentation of this file.
2
4
7
8#include "Editor.h"
9
11
12namespace armarx
13{
16 {
19
20 defs->optional(this->objectScaling,
21 "Editor.ObjectScaling",
22 "Scaling factor that is applied to all intractable objects.");
23
24 defs->optional(this->confidenceThreshold,
25 "Editor.ConfidenceThreshold",
26 "Only objects with a confidence greater than this value are shown.");
27
28 return defs;
29 }
30
31 std::string
33 {
34 return "InteractiveMemoryEditor";
35 }
36
37 void
39 {
40 {
41 providerInfo.objectType = objpose::ObjectType::KnownObject;
42
43 for (const auto& dataset : objectFinder.getDatasets())
44 {
45 std::vector<ObjectInfo> objects = objectFinder.findAllObjectsOfDataset(dataset);
46
47 for (const auto& obj : objects)
48 {
49 providerInfo.supportedObjects.push_back(armarx::toIce(obj.id()));
50 }
51 }
52 }
53 }
54
55 void
57 {
59
60 objectVizTask = new SimpleRunningTask<>([this]() { this->run(); });
61 objectVizTask->start();
62 }
63
64 void
68
69 void
73
74 void
75 ObjectMemoryEditor::run()
76 {
78
79 Editor::Properties properties = {
80 .providerName = getName(),
81 .objectScaling = objectScaling,
82 .confidenceThreshold = confidenceThreshold,
83 .availableObjects = providerInfo.supportedObjects,
84 };
85
86 Editor editor(
87 arviz,
88 properties,
90 { objectPoseTopic->reportObjectPoses(getName(), objpose::toIce(poses)); },
91 [client]() -> objpose::ObjectPoseSeq { return client.fetchObjectPoses(); });
92
93 Metronome metronome(Frequency::Hertz(20));
94 while (objectVizTask and not objectVizTask->isStopped())
95 {
96 editor.step();
97
98 metronome.waitForNextTick();
99 }
100 }
101
102 objpose::ProviderInfo
103 ObjectMemoryEditor::getProviderInfo(const Ice::Current& /*unused*/)
104 {
105 return providerInfo;
106 }
107
108 objpose::provider::RequestObjectsOutput
109 ObjectMemoryEditor::requestObjects(const objpose::provider::RequestObjectsInput& input,
110 const Ice::Current& /*unused*/)
111 {
112 objpose::provider::RequestObjectsOutput output;
113
114 for (const auto& id : input.objectIDs)
115 {
116 output.results[id].success = false;
117 }
118
119 return output;
120 }
121
123} // namespace armarx
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
Definition Decoupled.h:29
Default component property definition container.
Definition Component.h:70
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
static Frequency Hertz(std::int64_t hertz)
Definition Frequency.cpp:20
std::string getName() const
Retrieve name of object.
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
Pure virtual hook for the subclass.
void onExitComponent() override
Hook for subclass.
objpose::provider::RequestObjectsOutput requestObjects(const objpose::provider::RequestObjectsInput &input, const Ice::Current &) override
std::string getDefaultName() const override
Retrieve default name of component.
objpose::ProviderInfo getProviderInfo(const Ice::Current &=Ice::emptyCurrent) override
objpose::ObjectPoseClient getClient() const
objpose::ObjectPoseStorageInterfacePrx objectPoseTopic
Provides access to the armarx::objpose::ObjectPoseStorageInterface (aka the object memory).
ObjectPoseSeq fetchObjectPoses() const
Fetch all known object poses.
std::vector< ObjectPose > ObjectPoseSeq
std::vector< ProvidedObjectPose > ProvidedObjectPoseSeq
objpose::AABB toIce(const simox::AxisAlignedBoundingBox &aabb)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
SimpleRunningTask(Ts...) -> SimpleRunningTask< std::function< void(void)> >