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

PyKDL bindings on Precise are flaky #41

Closed
smits opened this issue Dec 9, 2014 · 23 comments
Closed

PyKDL bindings on Precise are flaky #41

smits opened this issue Dec 9, 2014 · 23 comments
Labels
Milestone

Comments

@smits
Copy link
Member

smits commented Dec 9, 2014

We've just witnessed the following behavior with the python bindings generated with sip 4.13.2 on Ubuntu Precise:

image

Digging deeper revealed that the underlying C++ object is correct but that the generation of the Python KDL.Vector object is wrong:

A: [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
B: [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           0,           0,           0]]
C: [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
(B*A): [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
C.p: [           1,           2,           3]
(B * A).p: [           0,           2,           3]
(B*A): [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
(B*A)[0][3]: 1.0
(B*A)[1][3]: 2.0
(B*A)[2][3]: 3.0
(B*A).p[0]: 0.0

This does not happen with bindings generated with sip 4.15.x on Ubuntu Precise or Trusty:

python test.py 
A: [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
B: [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           0,           0,           0]]
C: [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
(B*A): [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
C.p: [           1,           2,           3]
(B * A).p: [           1,           2,           3]
(B*A): [[           1,           0,           0;
            0,           1,           0;
            0,           0,           1]
[           1,           2,           3]]
(B*A)[0][3]: 1.0
(B*A)[1][3]: 2.0
(B*A)[2][3]: 3.0
(B*A).p[0]: 1.0

I currently see no easy way to resolve this on Ubuntu Precise except for updating your sip to 4.15. I personally used the following ppa for that: ppa:pali/kubuntu-backports

@daenny
Copy link

daenny commented Feb 22, 2018

I just did some other tests:
Generating the code up to SIP version 4.16.7 it works as expected.
From 4.16.8 up to 4.18 SIP generates code, but has issues:
#129

Using SIP 4.19.7 creates code, but importing the PyKDL library then actually segfaults...

@MatthijsBurgh
Copy link
Collaborator

MatthijsBurgh commented Jan 13, 2020

I have asked the PyQt mailing list, https://www.riverbankcomputing.com/mailman/listinfo/pyqt, for support.
The specific thread: http://python.6.x6.nabble.com/sip-Accessing-members-results-in-incorrect-missing-data-td5266521.html
@smits Could you please contribute?

@MatthijsBurgh
Copy link
Collaborator

With the developer of SIP, we have fixed a few bugs in SIP. This will fix both the incorrect data, this issue and #129, and the memory leak of #157.
The relevant fixes:
https://www.riverbankcomputing.com/hg/sip/rev/137b9be794a1
https://www.riverbankcomputing.com/hg/sip/rev/6a057b2d8537
https://www.riverbankcomputing.com/hg/sip/rev/699facc95914
https://www.riverbankcomputing.com/hg/sip/rev/82ec38dc0e63
For details see the mailing list: http://python.6.x6.nabble.com/sip-Accessing-members-results-in-incorrect-missing-data-td5266521.html

So you can either build python_orocos_kdl from source, with SIP from source. A new release, probably 4.19.21, will be released soon.

The debians are not maintained by the developer of SIP, but the Debian Python Modules Team (DPMT). Once the new SIP release is out, I will request them to update python-sip for all ubuntu versions 16+.

@MatthijsBurgh
Copy link
Collaborator

MatthijsBurgh commented Feb 2, 2020

Bug report filed on LaunchPad to get python-sip updated to 4.19.21 on 16.04 and 18.04, https://bugs.launchpad.net/ubuntu/+source/sip4/+bug/1861601

@MatthijsBurgh
Copy link
Collaborator

In my opinion a new released python-sip is needed to have a new release of python_orocos_kdl. There is not much happening on LaunchPad, so extra contributions by all of you is needed to get a new release.
Please contribute: @smits @traversaro @mrana6 @tfoote @zchen24 @mvieth @luzpaz @francisco-miguel-almeida @ahoarau @jbohren

@zchen24
Copy link
Contributor

zchen24 commented Feb 7, 2020 via email

@MatthijsBurgh
Copy link
Collaborator

MatthijsBurgh commented Feb 8, 2020

@zchen24 I cherry-picked your commit and did some extra fixes, but I get a segmentation fault with PyBind11 v2.4.3, see https://travis-ci.com/MatthijsBurgh/orocos_kinematics_dynamics/builds/148004083
The segmentation faults happen in the Pickle tests

@zchen24
Copy link
Contributor

zchen24 commented Feb 8, 2020

@MatthijsBurgh Wow, I did not expect that you will just run the continuous integration test on it. 👍
Regarding the status of Pybind11, the wrapping of the KDL library is pretty complete, but there could be some corner cases that are missing, and the Pickle test failure is expected as this feature has not been implemented yet. See https://pybind11.readthedocs.io/en/stable/advanced/classes.html#pickling-support. Besides pickle support, I also have a concern regarding the unit test coverage. I am happy to spend some time this weekend and might need your help with testing.

@traversaro
Copy link
Contributor

traversaro commented Feb 8, 2020

There is not much happening on LaunchPad, so extra contributions by all of you is needed to get a new release.
Please contribute: @smits @traversaro @mrana6 @tfoote @zchen24 @mvieth @luzpaz @francisco-miguel-almeida @ahoarau @jbohren

Hi @MatthijsBurgh, I have not used orocos_kdl in a long time, but I would be happy to give an hand if it is necessary. However, it is not clear to me how we can help. In particular, I do not think it is possible given how Ubuntu handles its releases to have a package to be update to a completely new version. If you were able to backport the fix as a patch, you could try to start the SRU process (https://wiki.ubuntu.com/StableReleaseUpdates) but even that is quite a long process (see for example ros/urdfdom#119). If you need this fixed in your setups in the short or even medium term, I would suggest to stop using the system python-sip and python_orocos_kdl, and ship your own version, either compiling them from source or providing updated versions via a PPA.

@MatthijsBurgh
Copy link
Collaborator

There is not much happening on LaunchPad, so extra contributions by all of you is needed to get a new release.
Please contribute: @smits @traversaro @mrana6 @tfoote @zchen24 @mvieth @luzpaz @francisco-miguel-almeida @ahoarau @jbohren

Hi @MatthijsBurgh, I have not used orocos_kdl in a long time, but I would be happy to give an hand if it is necessary. However, it is not clear to me how we can help. In particular, I do not think it is possible given how Ubuntu handles its releases to have a package to be update to a completely new version. If you were able to backport the fix as a patch, you could try to start the SRU process (https://wiki.ubuntu.com/StableReleaseUpdates) but even that is quite a long process (see for example ros/urdfdom#119). If you need this fixed in your setups in the short or even medium term, I would suggest to stop using the system python-sip and python_orocos_kdl, and ship your own version, either compiling them from source or providing updated versions via a PPA.

I have a solution for my own setup. But I would like to come up with a robust solution for the entire ROS community.
So the options:

  1. Get a SRU for python-sip, see https://bugs.launchpad.net/ubuntu/+source/sip4/+bug/1861601
  2. Replace SIP with PyBind11, see PyBind11 instead of SIP #219
  3. Release a updated version of python-sip via the ROS servers. Is this a possibility @traversaro?

@MatthijsBurgh
Copy link
Collaborator

PR for PyKDL based on PyBind11 is open: #229

python-sip fix is also pending for approval in ubuntu launchpad, so that should also be released in a few weeks.

@traversaro
Copy link
Contributor

Release a updated version of python-sip via the ROS servers. Is this a possibility @traversaro?

Sorry, I did not saw this mention back in time. I am not related in any way with the maintenance of the maintenance of debian packages on ROS servers, but think in the past the attitude was to try to avoid to release updated version of packages that are released in Ubuntu repositories in the ROS repositories, to avoid hard to debug conflicts or problems. I remember some discussion on a GitHub issue on this, but I at the moment I can't find it.

@MatthijsBurgh
Copy link
Collaborator

A fixed version of python-sip is now available on updates both for Xenial and Bionic.

@traversaro
Copy link
Contributor

Thanks for the hard work @MatthijsBurgh !

@jspricke
Copy link
Contributor

jspricke commented Apr 6, 2020

I guess the next step is to have a new release, @MatthijsBurgh ?
Can you do that @smits ?

@MatthijsBurgh
Copy link
Collaborator

@jspricke A new release on SIP is possible or merge #229 and release a PyBind11 based PyKDL. But both are up to @smits and @meyerj.

@smits
Copy link
Member Author

smits commented Apr 6, 2020

I'll try to release in the coming days. AFAIU the release is only required to regenerate the python bindings, right? Since we're going with option 1, in which a fixed python-sip will be available during build time?

@jspricke
Copy link
Contributor

jspricke commented Apr 6, 2020

We are interested in a new release from master to have #212 in there as well.

@MatthijsBurgh
Copy link
Collaborator

@smits, Yes, new python bindings need to be generated based on the updated python-sip release. You could use the same commit as the current PyKDL release, but there have been many changes since the last release, march 2018. So I would suggest an entire new release of both KDL and PyKDL.

PS. in #229 there are some fixes to the SIP version of PyKDL. I could create a separate PR for those commits, so these could be include in this release. Are you open for that?

@smits
Copy link
Member Author

smits commented Apr 17, 2020

@MatthijsBurgh we have to maintain binary compatibility for the existing ROS releases, so I can create a new release to be incorporated into the next ROS release but not for kinetic/melodic etc. unless we try to cherrypick the binary compatible fixes for 1.3 and 1.4

@MatthijsBurgh
Copy link
Collaborator

I think cherrypicking it all is a lot of work. So just keep it to new python bindings based on the same release. People will just need to build from source, if they want a newer version of (Py)KDL.

@MatthijsBurgh
Copy link
Collaborator

@smits could you create new package releases on kinetic and melodic based on the same commits as the current releases, but which use the new version of sip? This would fix this bug and #129 and #157.

@MatthijsBurgh
Copy link
Collaborator

16.04 has reached end-of-life, problem still on 18.04. That requires a re-release of the same version, but with updated sip.

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

No branches or pull requests

6 participants