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

Generalization of dmp learning for multiple trajectory #76

Open akhilkanduri opened 1 year ago

akhilkanduri commented 1 year ago

Hi great package and thank you,

I want to know if there is also a feature to train with multiple trajectories and generalize the task, example: if i change goal position then the similar trajectory must be applied for that condition.

Is it possible with this package?

stulp commented 1 year ago

Thanks for the feedback!

This functionality is known as "Contextual DMPs", a term introduced by Jan Peter's group uses. Other groups call it "parameterized skills" (Konidaris) or DMPs with "style parameters" (Matsubara). I used to use "parameterized skills" also (https://ieeexplore.ieee.org/abstract/document/7030008), but prefer the term "Contextual DMPs" now. https://github.com/stulp/dmpbbo/blob/v1.0.0/docs/dmp.bib

Contextual DMPs were available in C++ in v1.0 of dmpbbo: https://github.com/stulp/dmpbbo/blob/v1.0.0/src/dmp/DmpContextual.hpp This is the demo you are looking for, i.e. adapting the goal to a task parameter: https://github.com/stulp/dmpbbo/blob/v1.0.0/demos_cpp/dmp/demoDmpContextualGoal.cpp

This code still needs to be ported to the new and more flexible Python/C++ approach in v2.0 (I do not recommend using v1.* anymore). As this is a pet project and time is a limited resource, I only do such porting when someone asks for it (as you have done now :-)

It shouldn't be too much work in principle, but let me ask some questions before starting:

If you're motivated to do a code review, I'd be motivated to code it within a week or two. (no promises though...)

(it has been on the stack for a while #69)

akhilkanduri commented 1 year ago

Hey. Thanks for quick correspondence.

Re: Are you interested in a Python version only? Yes I am solely using python versions.

I am currently using it in my project and I am trying to implement it in a week. By tweaking the code for demo, I am able to change initial condition for y state and reach trained trajectory goal. But if i change the attractor state there is a problem in integration. I have tried to implement something like this https://h2t.anthropomatik.kit.edu/pdf/Zhou2017.pdf and also https://www.cmpe.boun.edu.tr/~emre/papers/Ugur-2020-ROB.pdf but i am stuck. I would be grateful for any help I am definitely interested in a contributing.

I hope you find some time for this.

stulp commented 1 year ago

I'll will not be able to implement this it in a week, but I can give you some pointers.

What do you mean "there is a problem in integration"? Do you mean scaling issues because of choosing an inappropriate frame of reference, as illustrated in Figure 14 in https://homes.cs.washington.edu/~todorov/courses/amath579/reading/DynamicPrimitives.pdf

In the Zhou2017 paper they use LWR. In general I prefer RBFN: simpler, and better properties for subsequent optimization, should it be needed.