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 #include <VirtualRobot/math/Helpers.h>
26 
28 
29 using namespace armarx;
30 
31 
32 BimanualGraspCandidateHelper::BimanualGraspCandidateHelper(const grasping::BimanualGraspCandidatePtr& candidate, VirtualRobot::RobotPtr robot)
33  : candidate(candidate), robot(robot)
34 {
35  ARMARX_CHECK_NOT_NULL(candidate);
36  ARMARX_CHECK_NOT_NULL(robot);
37 }
38 
40 {
41  const Eigen::Matrix4f curRobotPose = helper->robot->getGlobalPose();
42  const Eigen::Matrix4f graspPose = curRobotPose.inverse() * getGraspPoseInGlobal();
43  return graspPose;
44 }
45 
47 {
48  return math::Helpers::TranslatePose(getGraspPoseInRobotRoot(), getApproachVector() * approachDistance);
49 }
50 
52 {
53  return getGraspPoseInRobotRoot().topLeftCorner<3, 3>();
54 }
55 
57 {
58  return math::Helpers::GetPosition(getGraspPoseInRobotRoot());
59 }
60 
62 {
63  const Eigen::Matrix4f oldRobotPose = helper->defrost(helper->candidate->robotPose);
64  return oldRobotPose * graspPose;
65 }
67 {
68  return getGraspPoseInGlobal().topLeftCorner<3, 3>();
69 }
71 {
72  return math::Helpers::GetPosition(getGraspPoseInGlobal());
73 }
74 
76 {
77  return approachVector;
78 }
armarx::BimanualGraspCandidateHelper::BimanualGraspCandidateHelper
BimanualGraspCandidateHelper(const grasping::BimanualGraspCandidatePtr &candidate, VirtualRobot::RobotPtr robot)
Definition: BimanualGraspCandidateHelper.cpp:32
armarx::BimanualGraspCandidateHelper::Side::getGraspPositionInGlobal
Eigen::Vector3f getGraspPositionInGlobal() const
Definition: BimanualGraspCandidateHelper.cpp:70
armarx::BimanualGraspCandidateHelper::Side::getPrePoseInRobotRoot
Eigen::Matrix4f getPrePoseInRobotRoot(float approachDistance) const
Definition: BimanualGraspCandidateHelper.cpp:46
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:66
armarx::BimanualGraspCandidateHelper::Side::getApproachVector
Eigen::Vector3f getApproachVector() const
Definition: BimanualGraspCandidateHelper.cpp:75
armarx::BimanualGraspCandidateHelper::Side::getGraspOrientationInRobotRoot
Eigen::Matrix3f getGraspOrientationInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:51
armarx::BimanualGraspCandidateHelper::Side::getGraspPoseInRobotRoot
Eigen::Matrix4f getGraspPoseInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:39
ExpressionException.h
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::BimanualGraspCandidateHelper::Side::getGraspPositionInRobotRoot
Eigen::Vector3f getGraspPositionInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:56
armarx::BimanualGraspCandidateHelper::Side::getGraspPoseInGlobal
Eigen::Matrix4f getGraspPoseInGlobal() const
Definition: BimanualGraspCandidateHelper.cpp:61
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
BimanualGraspCandidateHelper.h