BimanualGraspCandidateHelper.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5  * Karlsruhe Institute of Technology (KIT), all rights reserved.
6  *
7  * ArmarX is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * ArmarX is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * @author Simon Ottenhaus (simon dot ottenhaus at kit dot edu)
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
25 
26 #include <VirtualRobot/Robot.h>
27 #include <VirtualRobot/math/Helpers.h>
28 
30 
31 using namespace armarx;
32 
34  const grasping::BimanualGraspCandidatePtr& candidate,
35  VirtualRobot::RobotPtr robot) :
36  candidate(candidate), robot(robot)
37 {
38  ARMARX_CHECK_NOT_NULL(candidate);
39  ARMARX_CHECK_NOT_NULL(robot);
40 }
41 
44 {
45  const Eigen::Matrix4f curRobotPose = helper->robot->getGlobalPose();
46  const Eigen::Matrix4f graspPose = curRobotPose.inverse() * getGraspPoseInGlobal();
47  return graspPose;
48 }
49 
52 {
53  return math::Helpers::TranslatePose(getGraspPoseInRobotRoot(),
54  getApproachVector() * approachDistance);
55 }
56 
59 {
60  return getGraspPoseInRobotRoot().topLeftCorner<3, 3>();
61 }
62 
63 Eigen::Vector3f
65 {
66  return math::Helpers::GetPosition(getGraspPoseInRobotRoot());
67 }
68 
71 {
72  const Eigen::Matrix4f oldRobotPose = helper->defrost(helper->candidate->robotPose);
73  return oldRobotPose * graspPose;
74 }
75 
78 {
79  return getGraspPoseInGlobal().topLeftCorner<3, 3>();
80 }
81 
82 Eigen::Vector3f
84 {
85  return math::Helpers::GetPosition(getGraspPoseInGlobal());
86 }
87 
88 Eigen::Vector3f
90 {
91  return approachVector;
92 }
armarx::BimanualGraspCandidateHelper::BimanualGraspCandidateHelper
BimanualGraspCandidateHelper(const grasping::BimanualGraspCandidatePtr &candidate, VirtualRobot::RobotPtr robot)
Definition: BimanualGraspCandidateHelper.cpp:33
armarx::BimanualGraspCandidateHelper::Side::getGraspPositionInGlobal
Eigen::Vector3f getGraspPositionInGlobal() const
Definition: BimanualGraspCandidateHelper.cpp:83
armarx::BimanualGraspCandidateHelper::Side::getPrePoseInRobotRoot
Eigen::Matrix4f getPrePoseInRobotRoot(float approachDistance) const
Definition: BimanualGraspCandidateHelper.cpp:51
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::BimanualGraspCandidateHelper::Side::getGraspOrientationInGlobal
Eigen::Matrix3f getGraspOrientationInGlobal() const
Definition: BimanualGraspCandidateHelper.cpp:77
armarx::BimanualGraspCandidateHelper::Side::getApproachVector
Eigen::Vector3f getApproachVector() const
Definition: BimanualGraspCandidateHelper.cpp:89
armarx::BimanualGraspCandidateHelper::Side::getGraspOrientationInRobotRoot
Eigen::Matrix3f getGraspOrientationInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:58
armarx::BimanualGraspCandidateHelper::Side::getGraspPoseInRobotRoot
Eigen::Matrix4f getGraspPoseInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:43
ExpressionException.h
armarx::BimanualGraspCandidateHelper::Side::getGraspPositionInRobotRoot
Eigen::Vector3f getGraspPositionInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:64
armarx::BimanualGraspCandidateHelper::Side::getGraspPoseInGlobal
Eigen::Matrix4f getGraspPoseInGlobal() const
Definition: BimanualGraspCandidateHelper.cpp:70
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:649
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
BimanualGraspCandidateHelper.h