ObjectPoseProviderPlugin.cpp
Go to the documentation of this file.
2 
4 
5 
6 namespace armarx::plugins
7 {
8 
10  {
11  if (!properties->hasDefinition(makePropertyName(PROPERTY_NAME)))
12  {
13  properties->defineOptionalProperty<std::string>(
14  makePropertyName(PROPERTY_NAME),
15  "ObjectPoseTopic",
16  "Name of the object pose topic.");
17  }
18  }
19 
21  {
22  parent<Component>().offeringTopicFromProperty(makePropertyName(PROPERTY_NAME));
23  }
24 
26  {
27  parent<ObjectPoseProviderPluginUser>().objectPoseTopic = createObjectPoseTopic();
28  }
29 
31  {
32  ObjectPoseProviderPluginUser& parent = this->parent<ObjectPoseProviderPluginUser>();
33  objpose::ObjectPoseTopicPrx& topic = parent.objectPoseTopic;
34  if (topic)
35  {
36  objpose::ProviderInfo info = parent.getProviderInfo();
37  if (!info.proxy)
38  {
39  info.proxy = ::armarx::objpose::ObjectPoseProviderPrx::checkedCast(parent.getProxy());
40  }
41  topic->reportProviderAvailable(parent.getName(), info);
42  }
43  else
44  {
45  ARMARX_ERROR << "Object pose topic not ready.";
46  }
47  }
48 
50  {
51  return parent<Component>().getTopicFromProperty<objpose::ObjectPoseTopicPrx>(makePropertyName(PROPERTY_NAME));
52  }
53 
54 }
55 
56 
57 namespace armarx
58 {
59 
61  {
62  addPlugin(plugin);
63  }
64 
65  objpose::provider::RequestObjectsOutput ObjectPoseProviderPluginUser::requestObjects(const objpose::provider::RequestObjectsInput& input, const Ice::Current&)
66  {
67  // ARMARX_INFO << "Requested " << input.objectIDs.size() << " objects for " << input.relativeTimeoutMS << " ms.";
68  objpose::provider::RequestObjectsOutput output;
69  for (const auto& id : input.objectIDs)
70  {
71  output.results[id].success = false;
72  }
73  return output;
74  }
75 
77  {
78  return plugin->createObjectPoseTopic();
79  }
80 
81 }
ObjectPoseProviderPlugin.h
armarx::ManagedIceObjectPlugin::parent
ManagedIceObject & parent()
Definition: ManagedIceObjectPlugin.cpp:69
armarx::ObjectPoseProviderPluginUser
Provides an objpose::ObjectPoseTopicPrx objectPoseTopic as member variable.
Definition: ObjectPoseProviderPlugin.h:43
armarx::ManagedIceObject::addPlugin
PluginT * addPlugin(const std::string prefix="", ParamsT &&...params)
Definition: ManagedIceObject.h:182
armarx::plugins::ObjectPoseProviderPlugin::preOnInitComponent
void preOnInitComponent() override
Definition: ObjectPoseProviderPlugin.cpp:20
armarx::plugins
This file is part of ArmarX.
Definition: DebugObserverComponentPlugin.cpp:28
armarx::ObjectPoseProviderPluginUser::ObjectPoseProviderPluginUser
ObjectPoseProviderPluginUser()
Definition: ObjectPoseProviderPlugin.cpp:60
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::plugins::ObjectPoseProviderPlugin::postOnConnectComponent
void postOnConnectComponent() override
Definition: ObjectPoseProviderPlugin.cpp:30
armarx::ProxyType::topic
@ topic
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
Component.h
armarx::plugins::ObjectPoseProviderPlugin::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: ObjectPoseProviderPlugin.cpp:9
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::plugins::ObjectPoseProviderPlugin::createObjectPoseTopic
objpose::ObjectPoseTopicPrx createObjectPoseTopic()
Definition: ObjectPoseProviderPlugin.cpp:49
armarx::ObjectPoseProviderPluginUser::requestObjects
objpose::provider::RequestObjectsOutput requestObjects(const objpose::provider::RequestObjectsInput &input, const Ice::Current &) override
Implement to process object requests (empty default implementation).
Definition: ObjectPoseProviderPlugin.cpp:65
armarx::ManagedIceObjectPlugin::makePropertyName
std::string makePropertyName(const std::string &name)
Definition: ManagedIceObjectPlugin.cpp:53
armarx::ManagedIceObject::getName
std::string getName() const
Retrieve name of object.
Definition: ManagedIceObject.cpp:107
armarx::ManagedIceObject::getProxy
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Definition: ManagedIceObject.cpp:393
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ObjectPoseProviderPluginUser::createObjectPoseTopic
objpose::ObjectPoseTopicPrx createObjectPoseTopic()
Definition: ObjectPoseProviderPlugin.cpp:76
armarx::plugins::ObjectPoseProviderPlugin::preOnConnectComponent
void preOnConnectComponent() override
Definition: ObjectPoseProviderPlugin.cpp:25