37 #include <VirtualRobot/Grasping/Grasp.h>
38 #include <VirtualRobot/Grasping/GraspSet.h>
39 #include <VirtualRobot/XML/ObjectIO.h>
42 using namespace VisualServoGroup;
55 VirtualRobot::ManipulationObjectPtr TwoArmVisualServoTowardsObjects::getObjectPtr(std::string objectName, VisualServoGroupStatechartContext* context)
58 memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx = context->getPriorKnowledge()->getObjectClassesSegment();
59 memoryx::CommonStorageInterfacePrx databasePrx = context->getPriorKnowledge()->getCommonStorage();
61 memoryx::EntityBasePtr entity = classesSegmentPrx->getEntityByName(objectName);
65 return simoxWrapper->getManipulationObject();
70 PosePtr TwoArmVisualServoTowardsObjects::getDesiredTcpOffsetToObject(std::string graspSetName, std::string graspName, VirtualRobot::ManipulationObjectPtr mo)
75 if (mo->getGraspSet(graspSetName))
77 VirtualRobot::GraspPtr grasp = mo->getGraspSet(graspSetName)->getGrasp(graspName);
81 ARMARX_WARNING <<
"No grasp with name " << graspName <<
" found! ";
85 transformationFromObjectToTCPPose = grasp->getTransformation().inverse();
87 ARMARX_VERBOSE <<
"Grasp " << graspName <<
" has value:\n" << grasp->getTransformation();
92 ARMARX_WARNING <<
"No grasp set with name " << graspSetName <<
" found! ";
95 Eigen::Matrix4f desiredTcpOffsetToObjectEigen = transformationFromObjectToTCPPose;
98 return new Pose(desiredTcpOffsetToObjectEigen);
105 VisualServoGroupStatechartContext* context = getContext<VisualServoGroupStatechartContext>();
107 VirtualRobot::ManipulationObjectPtr leftObjectPtr = getObjectPtr(in.getLeftObjectName(), context);
108 VirtualRobot::ManipulationObjectPtr rightObjectPtr = getObjectPtr(in.getRightObjectName(), context);
110 PosePtr leftDesiredTcpOffsetToObject = getDesiredTcpOffsetToObject(in.getLeftGraspSetName(), in.getLeftGraspDefinitionName(), leftObjectPtr);
111 PosePtr rightDesiredTcpOffsetToObject = getDesiredTcpOffsetToObject(in.getRightGraspSetName(), in.getRightGraspDefinitionName(), rightObjectPtr);
113 local.setLeftDesiredTcpOffsetToObject(leftDesiredTcpOffsetToObject);
114 local.setRightDesiredTcpOffsetToObject(rightDesiredTcpOffsetToObject);
120 context->getTCPControlUnit()->request();
128 VisualServoGroupStatechartContext* context = getContext<VisualServoGroupStatechartContext>();
130 context->getTCPControlUnit()->release();