-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInterpolationMethodsArms.py
86 lines (69 loc) · 5.89 KB
/
InterpolationMethodsArms.py
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
import InterpolationUtils
class InterpolationMethodsArms:
def __init__(self, positionRange):
self._armRangeRight = positionRange.GetArmRangeRight
self._armRangeLeft = positionRange.GetArmRangeLeft
#
# Right arm calculation
#
def CalcArmRight(self, ArmShoulderAngleRightPer, ArmForearmAngleRightPer,
ArmElbowTopAngleRightPer, ArmElbowBottAngleRightPer):
CalcGolPosShoulderRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmShoulderRightMax,
self._armRangeRight.ArmShoulderRightMin,
ArmShoulderAngleRightPer)
CalcGolPosForearmRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmForearmRightMax,
self._armRangeRight.ArmForearmRightMin,
ArmForearmAngleRightPer)
CalcGolPosElbowTopRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmElbowTopRightMax,
self._armRangeRight.ArmElbowTopRightMin,
ArmElbowTopAngleRightPer)
CalcGolPosElbowBottRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmElbowBottRightMax,
self._armRangeRight.ArmElbowBottRightMin,
ArmElbowBottAngleRightPer)
return CalcGolPosShoulderRight, CalcGolPosForearmRight, CalcGolPosElbowTopRight, CalcGolPosElbowBottRight
def CalcArmRightElbow(self, ArmShoulderAngleRightPer, ArmForearmAngleRightPer, ArmElbowAngleRightPer):
CalcGolPosShoulderRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmShoulderRightMax,
self._armRangeRight.ArmShoulderRightMin,
ArmShoulderAngleRightPer)
CalcGolPosForearmRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmForearmRightMax,
self._armRangeRight.ArmForearmRightMin,
ArmForearmAngleRightPer)
CalcGolPosElbowTopRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmElbowTopRightMax,
self._armRangeRight.ArmElbowTopRightMin,
ArmElbowAngleRightPer)
CalcGolPosElbowBottRight = InterpolationUtils.CalcAngle(self._armRangeRight.ArmElbowBottRightMax,
self._armRangeRight.ArmElbowBottRightMin,
ArmElbowAngleRightPer)
return CalcGolPosShoulderRight, CalcGolPosForearmRight, CalcGolPosElbowTopRight, CalcGolPosElbowBottRight
#
# Left arm calculation
#
def CalcArmLeft(self, ArmShoulderAngleLeftPer, ArmForearmAngleLeftPer,
ArmElbowAngleLeftPer, ArmElbowBottAngleRightPer):
CalcGolPosShoulderLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmShoulderLeftMax,
self._armRangeLeft.ArmShoulderLeftMin,
ArmShoulderAngleLeftPer)
CalcGolPosForearmLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmForearmLeftMax,
self._armRangeLeft.ArmForearmLeftMin,
ArmForearmAngleLeftPer)
CalcGolPosElbowTopLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmElbowTopLeftMax,
self._armRangeLeft.ArmElbowTopLeftMin,
ArmElbowAngleLeftPer)
CalcGolPosElbowBottLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmElbowBottLeftMax,
self._armRangeLeft.ArmElbowBottLeftMin,
ArmElbowBottAngleRightPer)
return CalcGolPosShoulderLeft, CalcGolPosForearmLeft, CalcGolPosElbowTopLeft, CalcGolPosElbowBottLeft
def CalcArmLeftElbow(self, ArmShoulderAngleLeftPer, ArmForearmAngleLeftPer, ArmElbowAngleLeftPer):
CalcGolPosShoulderLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmShoulderLeftMax,
self._armRangeLeft.ArmShoulderLeftMin,
ArmShoulderAngleLeftPer)
CalcGolPosForearmLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmForearmLeftMax,
self._armRangeLeft.ArmForearmLeftMin,
ArmForearmAngleLeftPer)
CalcGolPosElbowTopLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmElbowTopLeftMax,
self._armRangeLeft.ArmElbowTopLeftMin,
ArmElbowAngleLeftPer)
CalcGolPosElbowBottLeft = InterpolationUtils.CalcAngle(self._armRangeLeft.ArmElbowBottLeftMax,
self._armRangeLeft.ArmElbowBottLeftMin,
ArmElbowAngleLeftPer)
return CalcGolPosShoulderLeft, CalcGolPosForearmLeft, CalcGolPosElbowTopLeft, CalcGolPosElbowBottLeft