forked from madhephaestus/ESP32AnalogRead
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Link.h
60 lines (45 loc) · 1.3 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
/*
* Link.h
*
* Created on: Apr 27, 2021
* Author: aksha
*/
#ifndef LIBRARIES_KINEMATICCHAINSARDUINO_LINK_H_
#define LIBRARIES_KINEMATICCHAINSARDUINO_LINK_H_
#include "hardwareManager.h"
#include <Geometry.h>
void PrintMatrix(Matrix<4, 4> MatrixEx, String name);
Matrix<4, 4>& RotateZ(Matrix<4, 4> &poseT, float theta);
Matrix<4, 4>& RotateX(Matrix<4, 4> &poseT, float alpha);
Matrix<4, 4>& TranslateZ(Matrix<4, 4> &poseT, float D);
Matrix<4, 4>& TranslateX(Matrix<4, 4> &poseT, float R);
enum IKResult{ IKSuccess, JointLimits , ElbowTriangleSingularity, OutsideOfWorkspace, DHConfigError, NumberOfLinksError, Quadrants2and3Unreachable};
void PrintIKResult(IKResult Error);
class Link {
public:
int linkIndex;
float DH_Alpha;
float DH_D;
float DH_R;
float DH_Theta;
float ScaleActuator;
float Offset;
float MaxLink, MinLink;
hardwareManager* hwLocal;
int hardwarePin;
Link(int index,
float DH_alpha, float DH_d, float DH_R, float DH_Theta,
int ID, hardwareManager* hwptr,
float ScaleActuator,
float Offset,
float MaxLink,
float MinLink
);
/*
* getAngle returns angle of link in degrees
*/
float getAngle();
Matrix<4,4> &computeStep(Matrix <4,4> &pose, float currAngle);
IKResult cacheValue(float valueInDegrees);
};
#endif /* LIBRARIES_KINEMATICCHAINSARDUINO_LINK_H_ */