-
Notifications
You must be signed in to change notification settings - Fork 0
/
Link.h
147 lines (97 loc) · 2.96 KB
/
Link.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//
// Created by manurunga on 11/8/15.
//
#ifndef LIBKINE_LINK_H
#define LIBKINE_LINK_H
#include <armadillo>
using namespace std;
using namespace arma;
class Link {
public:
enum joint_t {
REVOLUTE = 0,
PRISMATIC = 1
};
// Define the DH-parameters
Link(double a, double alpha, double d, double theta, joint_t type = REVOLUTE);
~Link();
// Print out the transformation matrix in global coordinate frame
void PrintGlobalTransformationMatrix();
// Perform actuation, either rotational or prismatic
void ActuateJoint(double v);
// Apply the homogeneous transformation matrix in global coordinate frame
void SetGlobalTransformation(mat &T);
// Apply the homogeneous transformation matrix in local coordinate frame
void SetLocalTransformation(mat &T);
// Set the joint id
void SetId(int id);
// Provide value for theta (for rotational joint)
void SetTheta(double theta);
// Provide value for d (for translational joint)
void SetD(double d);
// Provide an STL file
void SetSTLFileName(const char *fn);
// Set the STL color
void SetColor(char c);
// Set joint limits
void SetJointLimits(double min, double max);
// Return the joint id
int GetJointId();
// Return a
double GetA();
// Return alpha
double GetAlpha();
// Return d
double GetD();
// Return theta
double GetTheta();
// Get rotation of the tip in global coordinate frame
void GetRotation(mat &R);
// Get position of the tip in global coordinate frame
void GetRotation(double R[3][3]);
// Get position of the tip in global coordinate frame
void GetPosition(mat &T);
// Get position of the tip in global coordinate frame
void GetPosition(double p[3]);
// In global coordinate frame, measured at the tip
void GetTransformation(mat &A);
// In local coordinate frame, measured at the tip
void GetLocalTransformation(mat &Tlocal);
// Return link ID
int GetId();
// Get the file name of the STL file
const char *GetSTLFileName();
// Get the defined color for the STL model
char GetColor();
// Get joint type
joint_t GetJointType();
// Get joint minimum range
double GetMinJointLimit();
// Get joint maximum range
double GetMaxJointLimit();
private:
// Joint id
int m_Id;
// Rotation about the xi-1 axis
double m_A;
// Translation along the x_(i-1) axis
double m_Alpha;
// Translation along the z_i axis
double m_D;
// Joint angle
double m_Theta;
// Global homogeneous transformation matrix, in global coordinate frame.
mat m_T;
// Local homogeneous transformation matrix, in local body coordinate frame.
mat m_Tlocal;
// 3D model of the link
string m_STLFileName;
// Link color as rgb
char m_Color;
joint_t m_Type;
// Maximum joint range
double m_JointMax;
// Minimum joint range
double m_JointMin;
};
#endif //LIBKINE_LINK_H