-
Notifications
You must be signed in to change notification settings - Fork 12
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
Test J̇ computation against AD #171
Conversation
Out of curiosity, I've tried to benchmark on CPU the two implementations:
This numbers refer to the computation of |
This could be interesting to all @ami-iit/vertical_control-oriented-learning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thanks Diego
assert jnp.einsum("l6g,g->l6", O_J̇_ad_WL_I, I_ν) == pytest.approx( | ||
jnp.einsum("l6g,g->l6", O_J̇_WL_I, I_ν) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm missing something, can we just compare the two
assert jnp.einsum("l6g,g->l6", O_J̇_ad_WL_I, I_ν) == pytest.approx( | |
jnp.einsum("l6g,g->l6", O_J̇_WL_I, I_ν) | |
) | |
assert O_J̇_ad_WL_I == pytest.approx(O_J̇_WL_I) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the elements of
I think it's more robust having also the projected values checked. I fear that comparing the Jacobians with too small numbers may provide a 0 = 0
even if the values are wrong (but so small that are within the default tolerances of pytest). And, I don't want to mess us with the tolerances. If something related to them is wrong, the last assert will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for the explanation
This PR extends the test included in #169 to compare the computation of$\dot{J}$ with the corresponding derivative computed as:
As usual, it's worth noting that since$\mathbf{q} = ( {}^W \mathbf{p}_B \,; {}^W \mathtt{Q}_B\,; \mathbf{s} ) \in \mathbb{R}^{7+n}$ , we have that $\dot{\mathbf{q}} \neq \boldsymbol{\nu}$ . However, by taking extra care of the derivative of the base quaternion, we can compute $\dot{\mathbf{q}}$ and use it in the test (that, btw, is independent from the velocity representation).
Triggered by #169 (comment) from @DanielePucci.
📚 Documentation preview 📚: https://jaxsim--171.org.readthedocs.build//171/