diff --git a/VirtualRobot/Grasping/Grasp.cpp b/VirtualRobot/Grasping/Grasp.cpp index e4c3103bfaf14d910ac966f46ba4b7e3e05eda1c..4fd984cf28eb048284b993e70f0e107f77b16a2f 100644 --- a/VirtualRobot/Grasping/Grasp.cpp +++ b/VirtualRobot/Grasping/Grasp.cpp @@ -150,6 +150,11 @@ namespace VirtualRobot return result; } + Eigen::Matrix4f Grasp::getTcpPoseRobotRoot(const Eigen::Matrix4f& objectPose, const RobotPtr& robot) const + { + return robot->getGlobalPose().inverse() * getTcpPoseGlobal(objectPose); + } + Eigen::Matrix4f Grasp::getObjectTargetPoseGlobal(const Eigen::Matrix4f& graspingPose) const { Eigen::Matrix4f result = graspingPose * poseTcp; diff --git a/VirtualRobot/Grasping/Grasp.h b/VirtualRobot/Grasping/Grasp.h index b3fa57fa04c787a5843bc20d49f60d51607d763c..942612ca9b3bc3c7be949f6dd259cb3375aecb92 100644 --- a/VirtualRobot/Grasping/Grasp.h +++ b/VirtualRobot/Grasping/Grasp.h @@ -74,6 +74,11 @@ namespace VirtualRobot */ Eigen::Matrix4f getTcpPoseGlobal(const Eigen::Matrix4f& objectPose) const; + /*! + Get the pose (relative to the robot root) that has to be achieved by the tcp in order to apply the grasp on the object at position objectPose. + */ + Eigen::Matrix4f getTcpPoseRobotRoot(const Eigen::Matrix4f& objectPose, const RobotPtr& robot) const; + /*! The returned pose is the object pose that have to be set in order to apply a grasp at pose graspingPose. */