from dynamic_graph.sot.curves import Bezier, Timeline b = Bezier('b') tl = Timeline('tl') b.controlPoints.value = ((0,0),(0,1),(1,1)) tl.timeMax.value = 1 tl.setState('start') for i,t in enumerate(range(11)): b.t.value = t/10.0 b.t.time = i b.state.recompute(i) tl.dummy.recompute(i) print t, b.state.value, tl.scaledTime.value, tl.scaledTime.time
from dynamic_graph.sot.curves import Bezier, Timeline, Spline from dynamic_graph import plug bezier = Bezier('bezier') timeline = Timeline('timeline') spline = Spline('spline') bezier.controlPoints.value = ((0,0), (10,20)) plug(spline.out, bezier.t) plug(timeline.scaledTime, spline.input) timeline.timeMax.value = 100 from dynamic_graph.sot.dynamics.hrp2 import Hrp2Laas, Hrp2Jrl from dynamic_graph.sot.dynamics.solver import Solver robot = Hrp2Laas("robot") solver = Solver(robot) robot.device.before.addSignal('timeline.dummy') robot.device.before.addSignal('bezier.state') robot.device.zmp.value = (0.,0.,0.) s = ['left-ankle', 'right-ankle'] for i in s: robot.dynamic.signal(i).recompute(robot.dynamic.signal(i).time + 1) robot.features[i].reference.value = robot.dynamic.signal(i).value robot.features[i]._feature.selec.value = '111111' robot.tasks[i].controlGain.value = 180.