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

Fix call to setComTarget in InverseKinematicsNLP #339

Merged
merged 2 commits into from
Apr 28, 2021
Merged

Conversation

diegoferigo
Copy link
Collaborator

Thekwargs have been removed from the upstream bindings.

@traversaro
Copy link
Contributor

Thekwargs have been removed from the upstream bindings.

Just to understand, this is something happened at the iDynTree level? Do you have a reference on the PR that made this change?

@diegoferigo
Copy link
Collaborator Author

diegoferigo commented Apr 28, 2021

Yep, the culprit is robotology/idyntree#822. SWIG generatesd kwargs only if there is no ambiguity between methods with the same name. All the duplications in iDynTree due to the Span support have the consequence of producing bindings without kwargs. All the existing code that was using kwargs (mainly for readability) gets broken.

@traversaro
Copy link
Contributor

Yep, the culprit is robotology/idyntree#822. SWIG generated kwargs only if there is no ambiguity between methods with the same name. All the duplications in iDynTree due to the Span support have the consequence of producing bindings without kwargs. All the existing code that was using kwargs (mainly for readability) gets broken.

Thanks, I had no idea. For the future I think that if you think that kwargs or other similar functionalities are useful, feel free to add a test for them on iDynTree (as per Beyonce's Rule, see Page 221 of https://abseil.io/resources/swe_at_google.2.pdf) otherwise it is difficult to catch these regression by manual inspection.

@diegoferigo
Copy link
Collaborator Author

diegoferigo commented Apr 28, 2021

Yep, the culprit is robotology/idyntree#822. SWIG generated kwargs only if there is no ambiguity between methods with the same name. All the duplications in iDynTree due to the Span support have the consequence of producing bindings without kwargs. All the existing code that was using kwargs (mainly for readability) gets broken.

Thanks, I had no idea. For the future I think that if you think that kwargs or other similar functionalities are useful, feel free to add a test for them on iDynTree (as per Beyonce's Rule, see Page 221 of https://abseil.io/resources/swe_at_google.2.pdf) otherwise it is difficult to catch these regression by manual inspection.

I think in this case there's nothing final we can do from downstream. This is not the only place where kwargs are used, and personally I always use them when I can because they greatly improve readability and make downstream code fail if upstream changes the arguments or their order (and this is a good thing otherwise upstream changes could get unnoticed).

In the case of SWIG bindings, maybe we should stop using kwargs because upstream changes like these ones break downstream Python code even though C++ APIs are not broken. I will slowly migrate the code I maintain to avoid their usage.

Note that this is a SWIG-only problem. I think that pybind11 handles it better because it forces upstream to select which method to override when there are multiple methods with the same name. SWIG instead binds all of them and tries to select the appropriate overload dynamically (I guess with a logic similar to multiple dispatch).

@traversaro
Copy link
Contributor

I think in this case there's nothing final we can do from downstream.

Yes, exactly for this reasonI mentioned adding tests in iDynTree itself, rather then downstream, to catch this problems before it gets released (even if in this specific case the ship has sailed).

@diegoferigo
Copy link
Collaborator Author

Yes, exactly for this reasonI mentioned adding tests in iDynTree itself, rather then downstream, to catch this problems before it gets released (even if in this specific case the ship has sailed).

Yes I agree with you. In this specific case I think it is more important keep iDynTree uniform, in the sense that there are already dozens of methods that, with the same name, offer the Span and non-Span variants. Now that we know that it's better avoiding using kwargs on SWIG resources, it's just matter of slowly migrating. We don't have much code that is affected.

@diegoferigo
Copy link
Collaborator Author

diegoferigo commented Apr 28, 2021

I'm not sure why the fuel test of the push job is failing with:

[Wrn] [LocalCache.cc:104] Server directory does not exist [/github/home/.ignition/fuel/fuel.ignitionrobotics.org]
[Err] [Filesystem.cc:459] Failed to create directory [/github/home/.ignition/fuel/fuel.ignitionrobotics.org/openrobotics/models/electrical box/3/materials/textures]: Not a directory
[Err] [Zip.cc:152] Error creating directory [/github/home/.ignition/fuel/fuel.ignitionrobotics.org/openrobotics/models/electrical box/3/materials/textures]. Do you have the right permissions?
[Err] [LocalCache.cc:416] Unable to unzip [/github/home/.ignition/fuel/fuel.ignitionrobotics.org/openrobotics/models/electrical box/3/electrical box.zip]
[Err] [utils.cpp:208] Failed to download Fuel model

The pull job is instead working fine. The difference between the two is that push build Dome with colcon while pull uses binaries from the PPA. Maybe there's some recent change that is not yet included in the binaries, but I couldn't find the source (I didn't search thoroughly). a17647d does not suffice.

@diegoferigo
Copy link
Collaborator Author

No luck, marking the test as flaky and merging as soon as CI turns green.

@diegoferigo
Copy link
Collaborator Author

Just found the culprit of the fuel test failure that was disabled in this PR: gazebosim/gz-fuel-tools#183.

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

Successfully merging this pull request may close these issues.

2 participants