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
34namespace 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 {
50 Eigen::Matrix4f getGraspPoseInRobotRoot() const;
51 Eigen::Matrix4f getPrePoseInRobotRoot(float approachDistance) const;
52 Eigen::Matrix3f getGraspOrientationInRobotRoot() const;
53 Eigen::Vector3f getGraspPositionInRobotRoot() const;
54
55 Eigen::Matrix4f getGraspPoseInGlobal() const;
56 Eigen::Matrix3f getGraspOrientationInGlobal() const;
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
103 Eigen::Matrix4f
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
BimanualGraspCandidateHelper(const BimanualGraspCandidateHelper &)=default
BimanualGraspCandidateHelper(const grasping::BimanualGraspCandidatePtr &candidate, VirtualRobot::RobotPtr robot)
BimanualGraspCandidateHelper & operator=(const BimanualGraspCandidateHelper &)=default
Eigen::Matrix4f defrost(const PoseBasePtr &base) const
const grasping::BimanualGraspCandidatePtr getGraspCandidate() const
BimanualGraspCandidateHelper & operator=(BimanualGraspCandidateHelper &&)=default
BimanualGraspCandidateHelper(BimanualGraspCandidateHelper &&)=default
Eigen::Vector3f defrost(const Vector3BasePtr &base) const
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< class BimanualGraspCandidateHelper > BimanualGraspCandidateHelperPtr
Eigen::Matrix4f getPrePoseInRobotRoot(float approachDistance) const