Go to the documentation of this file.00001 #ifndef GRASP_PLANNING_GRASPIT_EIGENGRASPRESULT_H
00002 #define GRASP_PLANNING_GRASPIT_EIGENGRASPRESULT_H
00003
00025 #include <string>
00026 #include <vector>
00027 #include <iostream>
00028
00029 #include <Eigen/Core>
00030 #include <Eigen/Geometry>
00031
00032 #include <grasp_planning_graspit/PrintHelpers.h>
00033
00034 namespace GraspIt
00035 {
00036
00048 class EigenGraspResult
00049 {
00050 public:
00051 typedef Eigen::Transform<double, 3, Eigen::Affine> EigenTransform;
00052
00053 EigenGraspResult() {}
00054 EigenGraspResult(const EigenGraspResult& o);
00055
00062 EigenGraspResult(const EigenTransform& _relTransform,
00063 const std::vector<double>& _dofsGrasp,
00064 const std::vector<double>& _dofsPregrasp,
00065 const std::vector<double>& _egVals,
00066 const bool _legal,
00067 const double _qualEpsilon,
00068 const double _qualVolume,
00069 const double _energy);
00070
00071
00072 const EigenTransform& getObjectToHandTransform() const
00073 {
00074 return relTransform;
00075 }
00076
00086 const std::vector<double>& getGraspJointDOFs() const
00087 {
00088 return graspDOFs;
00089 }
00093 const std::vector<double>& getPregraspJointDOFs() const
00094 {
00095 return pregraspDOFs;
00096 }
00097
00101 const std::vector<double>& getEigenGraspValues() const
00102 {
00103 return egVals;
00104 }
00105
00109 double getEnergy() const
00110 {
00111 return energy;
00112 }
00113
00117 bool isLegal() const
00118 {
00119 return legal;
00120 }
00121
00126 double qualityEpsilon() const
00127 {
00128 return qualEpsilon;
00129 }
00130
00131
00136 double qualityVolume() const
00137 {
00138 return qualVolume;
00139 }
00140
00141 friend std::ostream& operator<<(std::ostream& o, const EigenGraspResult& r)
00142 {
00143 if (r.isLegal()) o << "Legal grasp: ";
00144 else o << "Illegal grasp: ";
00145
00146
00147 o << "Energy = " << r.energy << " Joint DOFs = [";
00148 for (std::vector<double>::const_iterator it = r.graspDOFs.begin(); it != r.graspDOFs.end(); ++it)
00149 {
00150 o << *it;
00151 if ((it + 1) != r.graspDOFs.end()) o << ", ";
00152 }
00153 o << "] EigenGrasps = [";
00154 for (std::vector<double>::const_iterator it = r.egVals.begin(); it != r.egVals.end(); ++it)
00155 {
00156 o << *it;
00157 if ((it + 1) != r.egVals.end()) o << ", ";
00158 }
00159 o << "] Relative transform = " << r.relTransform;
00160 return o;
00161 }
00162
00163 private:
00164 EigenTransform relTransform;
00165
00166 std::vector<double> graspDOFs;
00167 std::vector<double> pregraspDOFs;
00168 std::vector<double> egVals;
00169
00170
00171 double energy;
00172
00173
00174 bool legal;
00175
00176
00177
00178 double qualEpsilon;
00179
00180
00181
00182 double qualVolume;
00183 };
00184 }
00185 #endif // GRASP_PLANNING_GRASPIT_EIGENGRASPRESULT_H