29 #include <RobotAPI/interface/components/ViewSelectionInterface.h>
33 using namespace PlaceObjectGroup;
36 WaitForHandAndObjectChannel::SubClassRegistry
50 PlaceObjectGroupStatechartContextBase* context =
51 getContext<PlaceObjectGroupStatechartContextBase>();
53 if (context->getObjectMemoryObserver()->getObjectInstancesByClass(in.getObjectName()).size() ==
57 ChannelRefBasePtr objectMemoryChannel =
58 context->getObjectMemoryObserver()->requestObjectClassRepeated(
59 in.getObjectName(), 200, armarx::DEFAULT_VIEWTARGET_PRIORITY);
61 if (objectMemoryChannel)
63 local.setObjectMemoryChannel(ChannelRefPtr::dynamicCast(objectMemoryChannel));
67 if (context->getObjectMemoryObserver()
68 ->getObjectInstancesByClass(in.getHandNameInMemory())
72 ChannelRefBasePtr handMemoryChannel =
73 context->getObjectMemoryObserver()->requestObjectClassRepeated(
74 in.getHandNameInMemory(), 300, armarx::DEFAULT_VIEWTARGET_PRIORITY);
76 if (handMemoryChannel)
79 local.setHandMemoryChannel(ChannelRefPtr::dynamicCast(handMemoryChannel));
87 int waitSec = in.getWaitUntilProcessSec();
97 PlaceObjectGroupStatechartContextBase* context =
98 getContext<PlaceObjectGroupStatechartContextBase>();
99 bool bothAvailable =
false;
100 memoryx::ChannelRefBaseSequence objectList;
102 memoryx::ChannelRefBaseSequence handList;
105 while (!isRunningTaskStopped() && !bothAvailable)
108 context->getObjectMemoryObserver()->getObjectInstancesByClass(in.getHandNameInMemory());
110 if (handList.size() > 0)
112 handChannel = ChannelRefPtr::dynamicCast(handList.at(0));
116 ARMARX_VERBOSE <<
"Hand " << in.getHandNameInMemory() <<
" not yet localized";
121 context->getObjectMemoryObserver()->getObjectInstancesByClass(in.getObjectName());
123 if (objectList.size() > 0)
125 objChannel = ChannelRefPtr::dynamicCast(objectList.at(0));
129 ARMARX_VERBOSE <<
"Object " << in.getObjectName() <<
" not localized";
139 out.setObjectChannelRef(objChannel);
142 out.setHandChannelRef(handChannel);
143 out.setObjectClassName(in.getObjectName());
144 bothAvailable =
true;
145 emitHandAndObjectLocalized();