1
1
from dynamic_graph import plug
2
- from dynamic_graph .sot .core . feature_point6d_relative import \
3
- FeaturePoint6dRelative
2
+ from dynamic_graph .sot .core import Flags
3
+ from dynamic_graph . sot . core . feature_point6d_relative import FeaturePoint6dRelative
4
4
from dynamic_graph .sot .core .matrix_util import matrixToTuple
5
5
from dynamic_graph .sot .core .meta_task_6d import MetaTask6d , toFlags
6
6
from dynamic_graph .sot .core .meta_tasks import generic6dReference , setGain
@@ -19,31 +19,22 @@ def createOpPointBase(self, opPointBase, opPointRefBase='left-wrist'):
19
19
20
20
def createOpPointModifBase (self ):
21
21
self .opPointModifBase = OpPointModifier ('opmodifBase' + self .name )
22
- plug (
23
- self .dyn .signal (self .opPointBase ),
24
- self .opPointModifBase .signal ('positionIN' ))
25
- plug (
26
- self .dyn .signal ('J' + self .opPointBase ),
27
- self .opPointModifBase .signal ('jacobianIN' ))
22
+ plug (self .dyn .signal (self .opPointBase ), self .opPointModifBase .signal ('positionIN' ))
23
+ plug (self .dyn .signal ('J' + self .opPointBase ), self .opPointModifBase .signal ('jacobianIN' ))
28
24
self .opPointModifBase .activ = False
29
25
30
26
def createFeatures (self ):
31
27
self .feature = FeaturePoint6dRelative ('featureRel' + self .name )
32
- self .featureDes = FeaturePoint6dRelative (
33
- 'featureRel' + self .name + '_ref' )
34
- self .feature .selec .value = '111111'
28
+ self .featureDes = FeaturePoint6dRelative ('featureRel' + self .name + '_ref' )
29
+ self .feature .selec .value = Flags ('111111' )
35
30
self .feature .frame ('current' )
36
31
37
32
def plugEverything (self ):
38
33
self .feature .setReference (self .featureDes .name )
39
34
plug (self .dyn .signal (self .opPoint ), self .feature .signal ('position' ))
40
35
plug (self .dyn .signal ('J' + self .opPoint ), self .feature .signal ('Jq' ))
41
- plug (
42
- self .dyn .signal (self .opPointBase ),
43
- self .feature .signal ('positionRef' ))
44
- plug (
45
- self .dyn .signal ('J' + self .opPointBase ),
46
- self .feature .signal ('JqRef' ))
36
+ plug (self .dyn .signal (self .opPointBase ), self .feature .signal ('positionRef' ))
37
+ plug (self .dyn .signal ('J' + self .opPointBase ), self .feature .signal ('JqRef' ))
47
38
self .task .add (self .feature .name )
48
39
plug (self .task .error , self .gain .error )
49
40
plug (self .gain .gain , self .task .controlGain )
@@ -52,13 +43,7 @@ def keep(self):
52
43
self .feature .position .recompute (self .dyn .position .time )
53
44
self .feature .keep ()
54
45
55
- def __init__ (self ,
56
- name ,
57
- dyn ,
58
- opPoint ,
59
- opPointBase ,
60
- opPointRef = 'right-wrist' ,
61
- opPointRefBase = 'left-wrist' ):
46
+ def __init__ (self , name , dyn , opPoint , opPointBase , opPointRef = 'right-wrist' , opPointRefBase = 'left-wrist' ):
62
47
self .name = name
63
48
self .defineDynEntities (dyn )
64
49
self .createOpPoint (opPoint , opPointRef )
@@ -80,21 +65,13 @@ def opmodifBase(self):
80
65
@opmodifBase .setter
81
66
def opmodifBase (self , m ):
82
67
if isinstance (m , bool ) and not m :
83
- plug (
84
- self .dyn .signal (self .opPointBase ),
85
- self .feature .signal ('positionRef' ))
86
- plug (
87
- self .dyn .signal ('J' + self .opPointBase ),
88
- self .feature .signal ('JqRef' ))
68
+ plug (self .dyn .signal (self .opPointBase ), self .feature .signal ('positionRef' ))
69
+ plug (self .dyn .signal ('J' + self .opPointBase ), self .feature .signal ('JqRef' ))
89
70
self .opPointModifBase .activ = False
90
71
else :
91
72
if not self .opPointModifBase .activ :
92
- plug (
93
- self .opPointModifBase .signal ('position' ),
94
- self .feature .positionRef )
95
- plug (
96
- self .opPointModifBase .signal ('jacobian' ),
97
- self .feature .JqRef )
73
+ plug (self .opPointModifBase .signal ('position' ), self .feature .positionRef )
74
+ plug (self .opPointModifBase .signal ('jacobian' ), self .feature .JqRef )
98
75
self .opPointModifBase .setTransformation (m )
99
76
self .opPointModifBase .activ = True
100
77
@@ -107,19 +84,13 @@ def goto6dRel(task, position, positionRef, gain=None, resetJacobian=True):
107
84
MRef = generic6dReference (positionRef )
108
85
task .featureDes .position .value = matrixToTuple (M )
109
86
task .featureDes .positionRef .value = matrixToTuple (MRef )
110
- task .feature .selec .value = "111111"
87
+ task .feature .selec .value = Flags ( "111111" )
111
88
setGain (task .gain , gain )
112
- if 'resetJacobianDerivative' in task .task .__class__ .__dict__ .keys (
113
- ) and resetJacobian :
89
+ if 'resetJacobianDerivative' in task .task .__class__ .__dict__ .keys () and resetJacobian :
114
90
task .task .resetJacobianDerivative ()
115
91
116
92
117
- def gotoNdRel (task ,
118
- position ,
119
- positionRef ,
120
- selec = None ,
121
- gain = None ,
122
- resetJacobian = True ):
93
+ def gotoNdRel (task , position , positionRef , selec = None , gain = None , resetJacobian = True ):
123
94
M = generic6dReference (position )
124
95
MRef = generic6dReference (positionRef )
125
96
if selec is not None :
@@ -130,8 +101,7 @@ def gotoNdRel(task,
130
101
task .featureDes .position .value = matrixToTuple (M )
131
102
task .featureDes .positionRef .value = matrixToTuple (MRef )
132
103
setGain (task .gain , gain )
133
- if 'resetJacobianDerivative' in task .task .__class__ .__dict__ .keys (
134
- ) and resetJacobian :
104
+ if 'resetJacobianDerivative' in task .task .__class__ .__dict__ .keys () and resetJacobian :
135
105
task .task .resetJacobianDerivative ()
136
106
137
107
0 commit comments