1 from dynamic_graph
import plug
3 from dynamic_graph.sot.core.feature_generic
import FeatureGeneric
4 from dynamic_graph.sot.core.gain_adaptive
import GainAdaptive
7 from dynamic_graph.sot.core.task
import Task
8 from numpy
import identity, matrix, zeros
16 "rankle": range(10, 12),
17 "lleg": range(12, 18),
18 "lhip": range(12, 15),
20 "lankle": range(16, 18),
21 "chest": range(18, 20),
22 "head": range(20, 22),
23 "rarm": range(22, 28),
24 "rshoulder": range(22, 25),
26 "rwrist": range(26, 28),
28 "larm": range(29, 35),
29 "lshoulder": range(29, 32),
31 "lwrist": range(33, 35),
39 self.
feature = FeatureGeneric(
"feature" + name)
41 self.
gain = GainAdaptive(
"gain" + name)
42 plug(dyn.position, self.
feature.errorIN)
43 robotDim = len(dyn.position.value)
48 self.task.add(self.
feature.name)
49 plug(self.task.error, self.
gain.error)
50 plug(self.
gain.gain, self.task.controlGain)
60 def gotoq(self, gain=None, qdes=None, **kwargs):
63 if isinstance(qdes, tuple):
66 if MetaTaskPosture.nbDof
is None:
67 MetaTaskPosture.nbDof = len(self.
feature.errorIN.value)
68 qdes = zeros((MetaTaskPosture.nbDof, 1))
72 ] * MetaTaskPosture.nbDof
73 for limbName, jointValues
in kwargs.items():
78 if isinstance(jointValues, matrix):
81 qdes[limbRange, 0] = jointValues
84 self.
feature.selec.value = Flags(act)
90 MetaTaskPosture.__init__(self, dyn, name)
91 self.
task = Task(
"task" + name)