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 "../ParticleFilter/Polygon.h"
30 #include "Calibration/Calibration.h"
31 #include "Calibration/StereoCalibration.h"
32 #include "Math/Math3d.h"
33 
34 namespace visionx
35 {
37  {
38  public:
39  class CFinger
40  {
41  public:
42  CFinger(std::vector<float> aJointOffsets, std::vector<Vec3d> aFingerTipCorners);
43 
44  void UpdateJointAngles(std::vector<float> aNewJointValues);
45 
46  std::vector<Vec3d>
47  m_aFingerTipCornersInFingerBaseCS; // positions of the fingertip corners in the coordinate system of the finger base
48  std::vector<Vec3d>
49  m_aFingerJointsInFingerBaseCS; // positions of the finger joints in the coordinate system of the finger base
50 
51  private:
52  std::vector<float> m_aJointOffsets; // distance from one joint to the next
53  std::vector<float> m_aJointAngles;
54  std::vector<Vec3d>
55  m_aFingerTipCornersInLocalCS; // relative positions of the fingertip corners in the coordinate system after the last joint
56  };
57 
58  CHandModelV2(std::string sConfigFileName, CStereoCalibration* pStereoCalibration);
59 
60  virtual ~CHandModelV2()
61  {
62  }
63 
64  virtual void UpdateHand(double* pConfig);
65  void UpdateHand(Vec3d vHandPosition,
66  Mat3d mHandOrientation,
67  float fPalmJointAngle,
68  std::vector<std::vector<float>>& aFingerJointAngles);
69 
70  std::vector<std::vector<Vec3d>> m_aFingerJointsInWorldCS;
71  std::vector<std::vector<Vec3d>> m_aFingerTipCornersInWorldCS;
72 
75 
76  std::vector<ConvexPolygonCalculations::Polygon> m_aFingerTipPolygonsLeftCam,
78 
81 
82  protected:
84  {
85  } // for derived classes
86 
87  std::string GetNextNonCommentLine(std::ifstream& sFileStream);
88 
89  void CalcProjectedPolygons();
90 
91  CStereoCalibration* m_pStereoCalibration;
92 
93  std::vector<CFinger*> m_aFingers; // 0th finger is thumb
94  std::vector<Vec3d>
95  m_aOffsetsToFingers; // 0: from hand base to first thumb joint, rest: from palm joint to first finger joint
97 
100  };
101 } // namespace visionx
visionx::CHandModelV2
Definition: HandModelV2.h:36
visionx::CHandModelV2::CFinger
Definition: HandModelV2.h:39
GfxTL::Vec3d
VectorXD< 3, double > Vec3d
Definition: VectorXD.h:737
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::CHandModelV2::m_fPalmJointAngle
float m_fPalmJointAngle
Definition: HandModelV2.h:96
visionx::CHandModelV2::~CHandModelV2
virtual ~CHandModelV2()
Definition: HandModelV2.h:60
visionx::CHandModelV2::m_pStereoCalibration
CStereoCalibration * m_pStereoCalibration
Definition: HandModelV2.h:91
visionx::CHandModelV2::m_aFingerTipPolygonsRightCam
std::vector< ConvexPolygonCalculations::Polygon > m_aFingerTipPolygonsRightCam
Definition: HandModelV2.h:77
visionx::CHandModelV2::m_vTrackingBallPosRightCam
Vec2d m_vTrackingBallPosRightCam
Definition: HandModelV2.h:79
visionx::CHandModelV2::m_aFingers
std::vector< CFinger * > m_aFingers
Definition: HandModelV2.h:93
visionx::CHandModelV2::CFinger::UpdateJointAngles
void UpdateJointAngles(std::vector< float > aNewJointValues)
Definition: HandModelV2.cpp:56
visionx::CHandModelV2::m_aFingerJointsInWorldCS
std::vector< std::vector< Vec3d > > m_aFingerJointsInWorldCS
Definition: HandModelV2.h:70
visionx::CHandModelV2::m_vTrackingBallOffset
Vec3d m_vTrackingBallOffset
Definition: HandModelV2.h:98
visionx::CHandModelV2::m_vHandPosition
Vec3d m_vHandPosition
Definition: HandModelV2.h:73
visionx::CHandModelV2::CFinger::m_aFingerTipCornersInFingerBaseCS
std::vector< Vec3d > m_aFingerTipCornersInFingerBaseCS
Definition: HandModelV2.h:47
visionx::CHandModelV2::CFinger::m_aFingerJointsInFingerBaseCS
std::vector< Vec3d > m_aFingerJointsInFingerBaseCS
Definition: HandModelV2.h:49
visionx::CHandModelV2::GetNextNonCommentLine
std::string GetNextNonCommentLine(std::ifstream &sFileStream)
Definition: HandModelV2.cpp:283
visionx::CHandModelV2::m_vTrackingBallPosLeftCam
Vec2d m_vTrackingBallPosLeftCam
Definition: HandModelV2.h:79
visionx::CHandModelV2::CalcProjectedPolygons
void CalcProjectedPolygons()
Definition: HandModelV2.cpp:419
GfxTL::Vec2d
VectorXD< 2, double > Vec2d
Definition: VectorXD.h:736
visionx::CHandModelV2::m_aFingerTipCornersInWorldCS
std::vector< std::vector< Vec3d > > m_aFingerTipCornersInWorldCS
Definition: HandModelV2.h:71
visionx::CHandModelV2::m_aOffsetsToFingers
std::vector< Vec3d > m_aOffsetsToFingers
Definition: HandModelV2.h:95
visionx::CHandModelV2::m_fTrackingBallRadiusLeftCam
float m_fTrackingBallRadiusLeftCam
Definition: HandModelV2.h:80
visionx::CHandModelV2::CFinger::CFinger
CFinger(std::vector< float > aJointOffsets, std::vector< Vec3d > aFingerTipCorners)
Definition: HandModelV2.cpp:34
visionx::CHandModelV2::m_mHandOrientation
Mat3d m_mHandOrientation
Definition: HandModelV2.h:74
visionx::CHandModelV2::m_fTrackingBallRadius
float m_fTrackingBallRadius
Definition: HandModelV2.h:99
visionx::CHandModelV2::m_fTrackingBallRadiusRightCam
float m_fTrackingBallRadiusRightCam
Definition: HandModelV2.h:80
visionx::CHandModelV2::UpdateHand
virtual void UpdateHand(double *pConfig)
Definition: HandModelV2.cpp:394
visionx::CHandModelV2::m_aFingerTipPolygonsLeftCam
std::vector< ConvexPolygonCalculations::Polygon > m_aFingerTipPolygonsLeftCam
Definition: HandModelV2.h:76
visionx::CHandModelV2::CHandModelV2
CHandModelV2()
Definition: HandModelV2.h:83