-
Notifications
You must be signed in to change notification settings - Fork 1
/
tendon_robot.h
91 lines (75 loc) · 2.92 KB
/
tendon_robot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef TENDON_ROBOT_H
#define TENDON_ROBOT_H
#include <vector>
#include <QApplication>
#include <QDomElement>
#include <Eigen/Dense>
#define EPSILON 1e-9
class TendonRobot
{
public:
TendonRobot();
~TendonRobot();
bool SetFromDomElement(QDomElement const& elem);
Eigen::Matrix4d & GetTipPose();
std::vector<Eigen::Matrix4d> GetAllDisksPose();
bool SetTendonLength(const Eigen::MatrixXd & robotTendonLengthChange, const Eigen::VectorXd & robotSegLength);
// Simple version of SetTendonLength(), NOT update robot geometry
Eigen::Matrix4d CalcTipPose(const Eigen::MatrixXd & robotTendonLengthChange, const Eigen::VectorXd & robotSegLength);
private:
class ConstCurvSegment
{
public:
ConstCurvSegment(double initExtLength,
double maxExtLength,
int numTendon,
int numDisk,
double pitchRadius,
double diskRadius,
double diskThickness);
int getDiskNum();
int getTendonNum();
double getMinSegLength();
double getMaxExtSegLength();
double getPitchRadius();
double getDiskRadius();
double getDiskThickness();
double getPhi();
Eigen::VectorXd getCurTendonLengthChange();
double getCurExtLength();
double getCurSegLength();
Eigen::Matrix4d & getSegTipPose();
std::vector<Eigen::Matrix4d> & getSegDisksPose();
bool ForwardKinematics(const Eigen::VectorXd & tendonLengthChange, const double curSegLength);
// Simple version of FK(), calculate and return tip pose only and does NOT update robot geometry
Eigen::Matrix4d ForwardKinematicsSimple(const Eigen::VectorXd & tendonLengthChange, const double curSegLength);
double CalcCurvature(const Eigen::VectorXd & q, const double l); // Robot dependent mapping only
double CalcMaxCurvature(const double l); // Max curvature given current length l
private:
// Property
double m_minSegLength; // l_j = m_minSegLength + m_curExtLength
double m_maxExtLength;
int m_numTendon; // i_j
int m_numDisk;
double m_pitchRadius;
double m_diskRadius;
double m_diskThickness;
// double m_baseRadialAngle; // support for: different tendon position from the last segment
// Geometry
double m_curExtLength;
Eigen::VectorXd m_tendonLengthChange;
double m_curvature; // κ
double m_twistAngle; // ϕ
std::vector<Eigen::Matrix4d> m_diskPose;
Eigen::Matrix4d m_segTipPose; // Same as the last disk pose
};
public:
int getNumSegment();
std::vector<ConstCurvSegment> & getSegments();
private:
int m_numSegment; // j
std::vector<ConstCurvSegment> m_segments;
Eigen::Matrix4d m_basePose;
Eigen::Matrix4d m_tipPose;
};
#endif // TENDON_ROBOT_H