27 #include "GraspObjectGroupStatechartContext.generated.h"
33 using namespace GraspObjectGroup;
47 GraspObjectGroupStatechartContext* context = getContext<GraspObjectGroupStatechartContext>();
51 context->getTCPControlUnit()->request();
55 if (in.isObjectInstanceChannelSet())
57 std::string objName = in.getObjectInstanceChannel()->getDataField(
"className")->getString();
58 auto handInstances = context->getObjectMemoryObserver()->getObjectInstancesByClass(
59 in.getHandMemoryChannel()->getDataField(
"className")->getString());
61 ChannelRefBasePtr handChannel = handInstances.front();
65 ChannelRefPtr::dynamicCast(handChannel));
67 context->getWorkingMemory()->getObjectInstancesSegment()->getEntityByName(objName));
69 context->getWorkingMemory()->getObjectInstancesSegment()->setNewMotionModel(object->getId(),
72 <<
"Attached object to "
73 << ChannelRefPtr::dynamicCast(handChannel)->getDataField(
"className")->getString();
77 std::string chainName = in.getKinematicChainName();
78 memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx =
79 context->getPriorKnowledge()->getObjectClassesSegment();
80 auto tcpObjectClass = classesSegmentPrx->getObjectClassByName(
81 in.getHandMemoryChannel()->getDataField(
"className")->getString());
84 context->getEntityDrawerTopic()->setObjectVisu(
85 "VisualServoHandVisu",
"tcpTarget_" + chainName, tcpObjectClass,
new Pose());
86 context->getEntityDrawerTopic()->updateObjectTransparency(
87 "VisualServoHandVisu",
"tcpTarget_" + chainName, 0.3);
90 local.setStartTimeRef(
91 ChannelRefPtr::dynamicCast(context->systemObserverPrx->startTimer(
"LiftHandTimer")));
100 GraspObjectGroupStatechartContext* context = getContext<GraspObjectGroupStatechartContext>();
102 context->getTCPControlUnit()->release();
105 context->systemObserverPrx->removeTimer(local.getStartTimeRef());
106 context->getEntityDrawerTopic()->removeLayer(
"VisualServoHandVisu");