36#include <VirtualRobot/Grasping/Grasp.h>
37#include <VirtualRobot/Grasping/GraspSet.h>
38#include <VirtualRobot/XML/ObjectIO.h>
44TwoArmVisualServoTowardsObjects::SubClassRegistry
55VirtualRobot::ManipulationObjectPtr
56TwoArmVisualServoTowardsObjects::getObjectPtr(std::string objectName,
57 VisualServoGroupStatechartContext* context)
60 memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx =
61 context->getPriorKnowledge()->getObjectClassesSegment();
62 memoryx::CommonStorageInterfacePrx databasePrx =
63 context->getPriorKnowledge()->getCommonStorage();
65 memoryx::EntityBasePtr entity = classesSegmentPrx->getEntityByName(objectName);
70 return simoxWrapper->getManipulationObject();
74TwoArmVisualServoTowardsObjects::getDesiredTcpOffsetToObject(std::string graspSetName,
75 std::string graspName,
76 VirtualRobot::ManipulationObjectPtr mo)
79 Eigen::Matrix4f transformationFromObjectToTCPPose = Eigen::Matrix4f::Identity();
81 if (mo->getGraspSet(graspSetName))
83 VirtualRobot::GraspPtr grasp = mo->getGraspSet(graspSetName)->getGrasp(graspName);
87 ARMARX_WARNING <<
"No grasp with name " << graspName <<
" found! ";
91 transformationFromObjectToTCPPose = grasp->getTransformation().inverse();
94 << grasp->getTransformation();
99 ARMARX_WARNING <<
"No grasp set with name " << graspSetName <<
" found! ";
102 Eigen::Matrix4f desiredTcpOffsetToObjectEigen = transformationFromObjectToTCPPose;
105 return new Pose(desiredTcpOffsetToObjectEigen);
112 VisualServoGroupStatechartContext* context = getContext<VisualServoGroupStatechartContext>();
114 VirtualRobot::ManipulationObjectPtr leftObjectPtr =
115 getObjectPtr(in.getLeftObjectName(), context);
116 VirtualRobot::ManipulationObjectPtr rightObjectPtr =
117 getObjectPtr(in.getRightObjectName(), context);
119 PosePtr leftDesiredTcpOffsetToObject = getDesiredTcpOffsetToObject(
120 in.getLeftGraspSetName(), in.getLeftGraspDefinitionName(), leftObjectPtr);
121 PosePtr rightDesiredTcpOffsetToObject = getDesiredTcpOffsetToObject(
122 in.getRightGraspSetName(), in.getRightGraspDefinitionName(), rightObjectPtr);
124 local.setLeftDesiredTcpOffsetToObject(leftDesiredTcpOffsetToObject);
125 local.setRightDesiredTcpOffsetToObject(rightDesiredTcpOffsetToObject);
131 context->getTCPControlUnit()->request();
139 VisualServoGroupStatechartContext* context = getContext<VisualServoGroupStatechartContext>();
141 context->getTCPControlUnit()->release();
static SubClassRegistry Registry
TwoArmVisualServoTowardsObjects(XMLStateConstructorParams stateData)
static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData)
Class for legacy to stay compatible with old statecharts.
SimoxObjectWrapper offers a simplified access to the Simox ManipulationObject (i.e visualization,...
GridFileManager provides utility functions for working with files in Mongo GridFS and links to them s...
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< Pose > PosePtr
IceInternal::Handle< XMLStateFactoryBase > XMLStateFactoryBasePtr
IceInternal::Handle< SimoxObjectWrapper > SimoxObjectWrapperPtr
IceInternal::Handle< ObjectClass > ObjectClassPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr