In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
from pydmps.dmp_discrete import DMPs_discrete

In [26]:
dmps = 7
bfs = 10
W = 200

init = load('../data/init_traj.npy')[0, 1:]
goal = load('../data/end_traj.npy')[0, 1:]
duration = 5.
f = 100.
dt = 1. / (f * duration)

dmp = DMPs_discrete(dmps=dmps, bfs=bfs, 
                    w=W*rand(dmps, bfs), 
                    y0=init, goal=goal,
                    ay=ones(dmps) * 25,
                    dt=dt)
y, _, _ = dmp.rollout()

plot(y)


Out[26]:
[<matplotlib.lines.Line2D at 0x7a407d0>,
 <matplotlib.lines.Line2D at 0x7a40950>,
 <matplotlib.lines.Line2D at 0x7a40ad0>,
 <matplotlib.lines.Line2D at 0x7a40c50>,
 <matplotlib.lines.Line2D at 0x7a40dd0>,
 <matplotlib.lines.Line2D at 0x7a40f50>,
 <matplotlib.lines.Line2D at 0x7a44110>]

In [36]:
t = linspace(0, duration, len(y))
traj = hstack((t.reshape(-1, 1), y))

save('../data/test.npy', traj)

In [7]:
traj = load('/tmp/baxter-playtraj.npy')
traj = load('../data/test.npy')

for i in range(1, 8):
    plot(traj[:, 0], traj[:, i])



In [ ]: