-
Notifications
You must be signed in to change notification settings - Fork 39
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Question of time-phase mapping and alpha value for canonical system alpha #49
Comments
According to Ijspeert et al. (2013), the differential equation You should be able to verify this by computing the derivative of the equation given by the function above. edit: For reference, this is the derivation of the direct solution: The Python function defines Then we can compute the derivative Let's call When according to Wolfram Alpha. :) Hence, combined with the equation before, we can write which is the definition of the phase variable. |
Using the formula from the first code snippet, you can compute the alpha that reaches a specific phase value after the execution time. This is what the function does. edit: For reference, this is the derivation of the formula. The direct mapping from time to phase is (just like before) Let's say we want to reach some constant The solution is The code is a bit different because it uses |
Using Ijspeert's assumption, shouldn't the solution be an exponential function? |
Would it be possible to compute the alpha using an exponential time-phase mapping? |
That's what is done here. I don't think I understood the question. |
I missed this reply. That seems to be indeed a way simpler form to express the same thing. However, I used the other version for such a long time that I am a bit worried about breaking anything, when changing the code. I would have to do an analysis of the numerical stability. edit: For reference, (I have no proof though.) |
There are some edge cases, in which the exponential mapping does not behave so nicely: import numpy as np
from movement_primitives.dmp._canonical_system import canonical_system_alpha, phase
import matplotlib.pyplot as plt
execution_time = 1e3
int_dt = 1e2
alpha_z = canonical_system_alpha(goal_z=1e-10, goal_t=execution_time, start_t=0.0, int_dt=int_dt)
print(alpha_z)
t = np.linspace(0.0, execution_time, 10000)
z = phase(t, alpha_z, goal_t=execution_time, start_t=0.0, int_dt=int_dt)
z2 = np.exp(-alpha_z * t / execution_time)
print(z[-1])
print(z2[-1])
plt.plot(t, z, label="old")
plt.plot(t, z2, ls="--", label=r"$\exp \frac{-\alpha_z t}{\tau}$")
plt.xlabel(r"t ($\tau=" + str(execution_time) + r"$)")
plt.ylabel("$z$")
plt.legend(loc="best")
plt.show() The exponential mapping approaches the desired target value very slowly and doesn't reach it for some reason. |
I thought about it again. When I use |
Hi thanks for addressing this issue. May I know how we can pull this update? |
After cloning the git repository, checkout the branch It will soon be merged to main. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hi, can you explain the reasoning for using this equation for the time-to-phase mapping?
Also, can you explain the reasoning for the canonical system alpha's calculation? I did not manage to find any literature that explain this
The text was updated successfully, but these errors were encountered: