Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Did dmpbbo support 6 DOF trajectory DMP training ? #85

Open
maoyangchien opened this issue Oct 13, 2023 · 4 comments
Open

Did dmpbbo support 6 DOF trajectory DMP training ? #85

maoyangchien opened this issue Oct 13, 2023 · 4 comments

Comments

@maoyangchien
Copy link

Hi, thank you for contributing to this great open-source project.

I have looked at the test process in the demo directory and also looked at the contents of the Trajectory.py and trajectory.txt files. I have a few questions to ask you:

  1. Looking at the structure of trajectory.txt, the first column is the timestamp, the second and third columns are the x, y coordinates, the fourth and fifth columns are the velocity in the x and y directions, and the fifth and sixth columns are the acceleration in the x and y directions. Is my understanding correct?

  2. If my target trajectory has 6 degrees of freedom and uses quaternion coordinates, such as (x, y, z, qx, qy, qz, qw), does dmpbbo support such coordinate trajectories? If I also provide the velocity and acceleration of x, y, z, how does dmpbbo handle qx, qy, qz, qw?

@stulp
Copy link
Owner

stulp commented Oct 13, 2023

The short answer is that yes, orientations can be represented in principle, but no, it is not supported explicitly. This is one of the main weaknesses of the current implementations,, and support for orientations is at the top of my wishlist.

In principle: yes

Quaternions can be implemented by adding them as miscellaneous variables to the trajectory:

def misc(self):
""" Get the miscellaneous variables over time.

You can then train a DMP with these miscellaneous variables with this function (i.e. instead of gains/forces, you would have orientations)

def from_traj_sched(cls, trajectory, func_apps_dmp, func_apps_schedules, **kwargs):
"""Initialize a DMP with schedules by training it from a trajectory (with schedules)
@param trajectory: the trajectory to train on
@param func_apps_dmp: Function approximators for the forcing term of the Dmp
@param func_apps_schedules: Function approximators for the schedules
@param kwargs:
- schedules: A matrix of (gain/force) schedules. If it is None, it is assumed the
schedules are stored in the "misc" property of the trajectory.
- min_schedules: min values for the schedules (scalar or array, one for each dimension)
- max_schedules: max values per the schedules (scalar or array, one for each dimension)
- All kwargs are eventually passed to the Dmp constructor.
"""

In practice: no

However, the DMP implementation does not know that these are quaternions, and would thus not ensure that they are normalized, for instance. So in practice, this is not a satisfactory solution.

The proper way would rather be to have trajectories and DMPs that are aware that they are dealing with orientations and/or quaternions. Although I have no time to implement that, I would be very happy to help design it and review code, in case someone is interested in pursuing this for a student project, for instance.

There are several ways this could be implemented, including

  • As in the "DMPs for quaternion control" section of the paper "Online movement adaptation based on previous sensor experiences"
  • Using Riemannian manifolds.

I also see that I need to improve the documentation of the Trajectory class...

@maoyangchien
Copy link
Author

Thank you for your quick reply. Can I first use dmpbbo to train trajectory data like timestamp, x, y, z, vx, vy, vz, ax, ay, az?

@maoyangchien
Copy link
Author

After carefully considering my needs, I still require quaternions coordinate information. I hope I can implement this feature, but I don't know where to start.

@stulp
Copy link
Owner

stulp commented Jan 13, 2024

This is probably what I would go for: https://arxiv.org/abs/2203.03374

Sorry, this would be a bigger project, and I don't have time to support that right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants