BimanualGraspCandidateHelper.h
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 
24 #pragma once
25 
26 
27 #include <memory>
28 
29 #include <VirtualRobot/VirtualRobot.h>
30 
31 #include <RobotAPI/interface/units/GraspCandidateProviderInterface.h>
33 
34 namespace armarx
35 {
36  typedef std::shared_ptr<class BimanualGraspCandidateHelper> BimanualGraspCandidateHelperPtr;
37 
39  {
40  public:
41  BimanualGraspCandidateHelper(const grasping::BimanualGraspCandidatePtr& candidate,
47 
48  struct Side
49  {
51  Eigen::Matrix4f getPrePoseInRobotRoot(float approachDistance) const;
53  Eigen::Vector3f getGraspPositionInRobotRoot() const;
54 
57  Eigen::Vector3f getGraspPositionInGlobal() const;
58 
59  Eigen::Vector3f getApproachVector() const;
60 
61  private:
63  const BimanualGraspCandidateHelper* helper;
64  Eigen::Matrix4f graspPose;
65  Eigen::Vector3f approachVector;
66  Eigen::Vector3f inwardsVector;
67  };
68 
69  Side
70  left() const
71  {
72  Side s;
73  s.helper = this;
74  s.graspPose = defrost(candidate->graspPoseLeft);
75  s.approachVector = defrost(candidate->approachVectorLeft);
76  s.inwardsVector = defrost(candidate->inwardsVectorLeft);
77  return s;
78  }
79 
80  Side
81  right() const
82  {
83  Side s;
84  s.helper = this;
85  s.graspPose = defrost(candidate->graspPoseRight);
86  s.approachVector = defrost(candidate->approachVectorRight);
87  s.inwardsVector = defrost(candidate->inwardsVectorRight);
88  return s;
89  }
90 
91  const grasping::BimanualGraspCandidatePtr
93  {
94  return candidate;
95  }
96 
97  Eigen::Vector3f
98  defrost(const Vector3BasePtr& base) const
99  {
100  return Vector3Ptr::dynamicCast(base)->toEigen();
101  }
102 
104  defrost(const PoseBasePtr& base) const
105  {
106  return PosePtr::dynamicCast(base)->toEigen();
107  }
108 
109  private:
110  grasping::BimanualGraspCandidatePtr candidate;
112  };
113 } // namespace armarx
armarx::BimanualGraspCandidateHelper::BimanualGraspCandidateHelper
BimanualGraspCandidateHelper(const grasping::BimanualGraspCandidatePtr &candidate, VirtualRobot::RobotPtr robot)
Definition: BimanualGraspCandidateHelper.cpp:33
armarx::BimanualGraspCandidateHelper::getGraspCandidate
const grasping::BimanualGraspCandidatePtr getGraspCandidate() const
Definition: BimanualGraspCandidateHelper.h:92
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
Pose.h
armarx::BimanualGraspCandidateHelper::left
Side left() const
Definition: BimanualGraspCandidateHelper.h:70
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::defrost
Eigen::Vector3f defrost(const Vector3BasePtr &base) const
Definition: BimanualGraspCandidateHelper.h:98
armarx::BimanualGraspCandidateHelper::Side::getGraspOrientationInRobotRoot
Eigen::Matrix3f getGraspOrientationInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:58
armarx::BimanualGraspCandidateHelper::Side::getGraspPoseInRobotRoot
Eigen::Matrix4f getGraspPoseInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:43
armarx::BimanualGraspCandidateHelper::Side
Definition: BimanualGraspCandidateHelper.h:48
armarx::BimanualGraspCandidateHelper::defrost
Eigen::Matrix4f defrost(const PoseBasePtr &base) const
Definition: BimanualGraspCandidateHelper.h:104
armarx::BimanualGraspCandidateHelper
Definition: BimanualGraspCandidateHelper.h:38
armarx::BimanualGraspCandidateHelper::operator=
BimanualGraspCandidateHelper & operator=(const BimanualGraspCandidateHelper &)=default
armarx::Side
Definition: NaturalIKTest.cpp:610
armarx::BimanualGraspCandidateHelper::Side::getGraspPositionInRobotRoot
Eigen::Vector3f getGraspPositionInRobotRoot() const
Definition: BimanualGraspCandidateHelper.cpp:64
armarx::BimanualGraspCandidateHelper::right
Side right() const
Definition: BimanualGraspCandidateHelper.h:81
armarx::BimanualGraspCandidateHelperPtr
std::shared_ptr< class BimanualGraspCandidateHelper > BimanualGraspCandidateHelperPtr
Definition: BimanualGraspCandidateHelper.h:36
armarx::BimanualGraspCandidateHelper::Side::getGraspPoseInGlobal
Eigen::Matrix4f getGraspPoseInGlobal() const
Definition: BimanualGraspCandidateHelper.cpp:70
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:649
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
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