HandModelV2.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 #include <string>
27 
28 // IVT
29 #include "Math/Math3d.h"
30 #include "Calibration/StereoCalibration.h"
31 #include "Calibration/Calibration.h"
32 
33 
34 #include "../ParticleFilter/Polygon.h"
35 
36 
37 
38 namespace visionx
39 {
41  {
42  public:
43  class CFinger
44  {
45  public:
46  CFinger(std::vector<float> aJointOffsets, std::vector<Vec3d> aFingerTipCorners);
47 
48  void UpdateJointAngles(std::vector<float> aNewJointValues);
49 
50  std::vector<Vec3d> m_aFingerTipCornersInFingerBaseCS; // positions of the fingertip corners in the coordinate system of the finger base
51  std::vector<Vec3d> m_aFingerJointsInFingerBaseCS; // positions of the finger joints in the coordinate system of the finger base
52 
53  private:
54  std::vector<float> m_aJointOffsets; // distance from one joint to the next
55  std::vector<float> m_aJointAngles;
56  std::vector<Vec3d> m_aFingerTipCornersInLocalCS; // relative positions of the fingertip corners in the coordinate system after the last joint
57  };
58 
59 
60  CHandModelV2(std::string sConfigFileName, CStereoCalibration* pStereoCalibration);
61  virtual ~CHandModelV2() {}
62  virtual void UpdateHand(double* pConfig);
63  void UpdateHand(Vec3d vHandPosition, Mat3d mHandOrientation, float fPalmJointAngle, std::vector<std::vector<float> >& aFingerJointAngles);
64 
65  std::vector<std::vector<Vec3d> > m_aFingerJointsInWorldCS;
66  std::vector<std::vector<Vec3d> > m_aFingerTipCornersInWorldCS;
67 
70 
71  std::vector<ConvexPolygonCalculations::Polygon> m_aFingerTipPolygonsLeftCam, m_aFingerTipPolygonsRightCam;
72 
75 
76  protected:
77  CHandModelV2() { } // for derived classes
78 
79  std::string GetNextNonCommentLine(std::ifstream& sFileStream);
80 
81  void CalcProjectedPolygons();
82 
83  CStereoCalibration* m_pStereoCalibration;
84 
85  std::vector<CFinger*> m_aFingers; // 0th finger is thumb
86  std::vector<Vec3d> m_aOffsetsToFingers; // 0: from hand base to first thumb joint, rest: from palm joint to first finger joint
88 
91  };
92 }
93 
visionx::CHandModelV2
Definition: HandModelV2.h:40
visionx::CHandModelV2::CFinger
Definition: HandModelV2.h:43
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::CHandModelV2::m_fPalmJointAngle
float m_fPalmJointAngle
Definition: HandModelV2.h:87
GfxTL::Vec2d
VectorXD< 2, double > Vec2d
Definition: VectorXD.h:694
visionx::CHandModelV2::~CHandModelV2
virtual ~CHandModelV2()
Definition: HandModelV2.h:61
visionx::CHandModelV2::m_pStereoCalibration
CStereoCalibration * m_pStereoCalibration
Definition: HandModelV2.h:83
visionx::CHandModelV2::m_aFingerTipPolygonsRightCam
std::vector< ConvexPolygonCalculations::Polygon > m_aFingerTipPolygonsRightCam
Definition: HandModelV2.h:71
visionx::CHandModelV2::m_vTrackingBallPosRightCam
Vec2d m_vTrackingBallPosRightCam
Definition: HandModelV2.h:73
visionx::CHandModelV2::m_aFingers
std::vector< CFinger * > m_aFingers
Definition: HandModelV2.h:85
visionx::CHandModelV2::CFinger::UpdateJointAngles
void UpdateJointAngles(std::vector< float > aNewJointValues)
Definition: HandModelV2.cpp:57
visionx::CHandModelV2::m_aFingerJointsInWorldCS
std::vector< std::vector< Vec3d > > m_aFingerJointsInWorldCS
Definition: HandModelV2.h:65
visionx::CHandModelV2::m_vTrackingBallOffset
Vec3d m_vTrackingBallOffset
Definition: HandModelV2.h:89
GfxTL::Vec3d
VectorXD< 3, double > Vec3d
Definition: VectorXD.h:695
visionx::CHandModelV2::m_vHandPosition
Vec3d m_vHandPosition
Definition: HandModelV2.h:68
visionx::CHandModelV2::CFinger::m_aFingerTipCornersInFingerBaseCS
std::vector< Vec3d > m_aFingerTipCornersInFingerBaseCS
Definition: HandModelV2.h:50
visionx::CHandModelV2::CFinger::m_aFingerJointsInFingerBaseCS
std::vector< Vec3d > m_aFingerJointsInFingerBaseCS
Definition: HandModelV2.h:51
visionx::CHandModelV2::GetNextNonCommentLine
std::string GetNextNonCommentLine(std::ifstream &sFileStream)
Definition: HandModelV2.cpp:274
visionx::CHandModelV2::m_vTrackingBallPosLeftCam
Vec2d m_vTrackingBallPosLeftCam
Definition: HandModelV2.h:73
visionx::CHandModelV2::CalcProjectedPolygons
void CalcProjectedPolygons()
Definition: HandModelV2.cpp:386
visionx::CHandModelV2::m_aFingerTipCornersInWorldCS
std::vector< std::vector< Vec3d > > m_aFingerTipCornersInWorldCS
Definition: HandModelV2.h:66
visionx::CHandModelV2::m_aOffsetsToFingers
std::vector< Vec3d > m_aOffsetsToFingers
Definition: HandModelV2.h:86
visionx::CHandModelV2::m_fTrackingBallRadiusLeftCam
float m_fTrackingBallRadiusLeftCam
Definition: HandModelV2.h:74
visionx::CHandModelV2::CFinger::CFinger
CFinger(std::vector< float > aJointOffsets, std::vector< Vec3d > aFingerTipCorners)
Definition: HandModelV2.cpp:36
visionx::CHandModelV2::m_mHandOrientation
Mat3d m_mHandOrientation
Definition: HandModelV2.h:69
visionx::CHandModelV2::m_fTrackingBallRadius
float m_fTrackingBallRadius
Definition: HandModelV2.h:90
visionx::CHandModelV2::m_fTrackingBallRadiusRightCam
float m_fTrackingBallRadiusRightCam
Definition: HandModelV2.h:74
visionx::CHandModelV2::UpdateHand
virtual void UpdateHand(double *pConfig)
Definition: HandModelV2.cpp:358
visionx::CHandModelV2::m_aFingerTipPolygonsLeftCam
std::vector< ConvexPolygonCalculations::Polygon > m_aFingerTipPolygonsLeftCam
Definition: HandModelV2.h:71
visionx::CHandModelV2::CHandModelV2
CHandModelV2()
Definition: HandModelV2.h:77