stulp / dmpbbo

Python/C++ library for Dynamical Movement Primitives and Black-Box Optimization
GNU Lesser General Public License v2.1
224 stars 90 forks source link

train multiple trajectories with different initial and attractor #52

Closed jacknlliu closed 4 years ago

jacknlliu commented 5 years ago

Could current implement of DMPs train multiple trajectories with different init and attractor?

stulp commented 4 years ago

Yes, this is possible with a ContextualDmp. See for instance this demo: https://github.com/stulp/dmpbbo/blob/master/demos_cpp/dmp/demoDmpContextualGoal.cpp

The important line is this one, where a function approximator that maps the task parameters to the goal parameters is passed to the contextual DMP. https://github.com/stulp/dmpbbo/blob/master/demos_cpp/dmp/demoDmpContextualGoal.cpp#L137

This function "policy_parameter_function_goal" is denoted "m" in this paper: http://www.isir.upmc.fr/files/2013ACTI2891.pdf "Because the goal must be adapted, we also learn a mapping xg=m(q)". This is what you are interested in, and this is what is illustrated in demoDmpContextualGoal.

(It would be straightforward to code the same for the initial position.)

jacknlliu commented 4 years ago

@stulp thanks, it's what I expected. And it's nice if a python version is provided.