def __init__(self, dmps, bfs, dt=.01, y0=0, goal=1, w=None, ay=None, by=None, **kwargs): """ dmps int: number of dynamic motor primitives bfs int: number of basis functions per DMP dt float: timestep for simulation y0 list: initial state of DMPs goal list: goal state of DMPs w list: tunable parameters, control amplitude of basis functions ay int: gain on attractor term y dynamics by int: gain on attractor term y dynamics """ self.dmps = dmps self.bfs = bfs self.dt = dt if isinstance(y0, (int, float)): y0 = np.ones(self.dmps) * y0 self.y0 = y0 if isinstance(goal, (int, float)): goal = np.ones(self.dmps) * goal self.goal = goal if w is None: # default is f = 0 w = np.zeros((self.dmps, self.bfs)) self.w = w if ay is None: ay = np.ones(dmps) * 25 # Schaal 2012 self.ay = ay if by is None: by = self.ay.copy() / 4 # Schaal 2012 self.by = by # set up the CS self.cs = CanonicalSystem(dt=self.dt, **kwargs) self.timesteps = int(self.cs.run_time / self.dt) # set up the DMP system self.reset_state()