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

Parametric improvements #72

Merged
merged 32 commits into from
Mar 22, 2024
Merged

Conversation

S-Dafarra
Copy link
Member

@S-Dafarra S-Dafarra commented Feb 29, 2024

Fixes #68
Fixes #69
Fixes #70
Fixes #71

This PR also adds a conversion function from an adam model to an iDynTree model

S-Dafarra added a commit to ami-iit/hippopt that referenced this pull request Mar 4, 2024
@S-Dafarra
Copy link
Member Author

Tests are failing because the changes of robotology/idyntree#1160 are not yet available in conda.

@S-Dafarra
Copy link
Member Author

Tests are failing because the changes of robotology/idyntree#1160 are not yet available in conda.

It should be soon conda-forge/idyntree-feedstock#78

@S-Dafarra
Copy link
Member Author

CI is now happy. The PR is ready to be reviewed. In particular, I would love the comments of:

@S-Dafarra S-Dafarra marked this pull request as ready for review March 12, 2024 11:23
@S-Dafarra S-Dafarra self-assigned this Mar 12, 2024
@@ -248,28 +250,27 @@ def gravity_term_fun(self) -> cs.Function:
self.f_opts,
)

def forward_kinematics(self, frame, T_b, s) -> cs.Function:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this only to recall the reason why this has been deleted:
there exists the function forward_kinematics_fun, this was a left over.

src/adam/parametric/casadi/computations_parametric.py Outdated Show resolved Hide resolved
src/adam/parametric/jax/computations_parametric.py Outdated Show resolved Hide resolved
src/adam/parametric/numpy/computations_parametric.py Outdated Show resolved Hide resolved
src/adam/parametric/pytorch/computations_parametric.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Giulero Giulero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @S-Dafarra, you fixed a lot of old wrong typing!
The idyntree model export is great! We could also use the same logic in the future to create adam models from idyntree ones.
Btw everything looks good to me :)

Comment on lines +85 to +87
for i in range(3):
for j in range(3):
idyn_spatial_rotational_inertia.setVal(i, j, inertia_matrix[i, j])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure about this. Is it possible to use idyntree.fromPython?
Maybe it just works with some specific types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try that, but unfortunately FromPython is defined byMatrix3x3 from which RotationalInertia inherits, and it is a static method, so it returns a Matrix3x3 instead of a RotationalInertia. In the end, this was the only method I managed to use reliably

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was imagining it :)

Comment on lines -122 to -129
def get_ordered_link_list(self):
"""get the ordered list of the link, based on the direction of the graph

Returns:
list: ordered link list
"""
return self.tree.get_ordered_nodes_list()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a never used method 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was throwing a warning since self.tree.get_ordered_nodes_list requires an argument that was not passed here, so I figured it was not really used 😊

@Giulero
Copy link
Collaborator

Giulero commented Mar 12, 2024

During the review, I also figured out that some files are signed with the old license (see #64)

# This software may be modified and distributed under the terms of the
# GNU Lesser General Public License v2.1 or any later version.

I will update them in a different PR.

Returns:
iDynTree.SolidShape: the iDynTree solid shape
"""
visual_position = idyntree.bindings.Position.FromPython(visual.origin.xyz)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vaguely recall that due to a change by @GiulioRomualdi it is not necessary anymore to call FromPython, but for sure he remember better.

for i in range(3):
for j in range(3):
idyn_spatial_rotational_inertia.setVal(i, j, inertia_matrix[i, j])
rotated_inertia = inertia_rotation * idyn_spatial_rotational_inertia
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that you avoided this, it is a common bug in URDF parsers, see ros/robot_model#66 and ros/robot_model#117 .

@Giulero
Copy link
Collaborator

Giulero commented Mar 21, 2024

Hi @S-Dafarra ! Can we merge the PR? :)

@S-Dafarra
Copy link
Member Author

Hi @S-Dafarra ! Can we merge the PR? :)

Hi @Giulero, there was this point open, but at this point I think we can proceed 😉

@traversaro
Copy link
Contributor

Hi @S-Dafarra ! Can we merge the PR? :)

Hi @Giulero, there was this point open, but at this point I think we can proceed 😉

Sure!

@Giulero
Copy link
Collaborator

Giulero commented Mar 22, 2024

Thanks a lot! <3 Merging.

@Giulero Giulero merged commit 45ea57e into ami-iit:main Mar 22, 2024
8 checks passed
@S-Dafarra S-Dafarra deleted the parametric_improvements branch March 22, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants