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: PyBind11 based #229

Merged
merged 136 commits into from
May 6, 2020
Merged

PyKDL: PyBind11 based #229

merged 136 commits into from
May 6, 2020

Conversation

MatthijsBurgh
Copy link
Collaborator

@MatthijsBurgh MatthijsBurgh commented Mar 29, 2020

This PR includes the following:

  • PyKDL based on PyBind11, which is an option, BUILD_PYKDL_PYBIND11. So SIP is still there, but PyBind11 is the default. PyBind11 is included as submodule.
  • Improvements on PyKDL based on SIP
    • Moved std::vector support to separate file.
    • Fixed custom methodcode which contained a return. Which isn't allowed in SIP. Mostly __getitem__ and __setitem__ functions.
    • Added some extra constructors, __repr__ and equality operators.
  • Improvements on kdl, which were needed to fix issues in PyKDL.
  • Extending the PyKDL tests. Mostly on the Frames and FrameVel classes. (Still a lot to gain)
  • Cleanup of kdl cmake. Contained some duplicate and unneeded code.
  • Python 3 support. Both for PyBind11 as SIP. I have chose to include the Fixed in c++ as well and replace all uses of None by Fixed. None is still there and points to Fixed, so any usage of None still works. For SIP I have used the changes of Fix/python3 joint none #137, but with a slight difference, python 3 as the new default.

Resolves #219
Fixes #227, fixes #230

zchen24 and others added 30 commits March 14, 2020 10:15
This prevents docstrings like:
__init__(self: PyKDL.Segment, name: unicode, joint: PyKDL.Joint = NoName:[None,
axis: [           0,           0,           0], origin[           0,
0,           0]], f_tip: PyKDL.Frame = [[           1,           0,
0;
            0,           1,           0;
            0,           0,           1]
[           0,           0,           0]], I: PyKDL.RigidBodyInertia =
<PyKDL.RigidBodyInertia object at 0x7f78c1d9fc38>) -> None
Instead the docstring looks like:
__init__(self: PyKDL.Segment, name: unicode, joint: PyKDL.Joint =
Joint(), f_tip: PyKDL.Frame = Frame.Identity(), I:
PyKDL.RigidBodyInertia = RigidBodyInertia.Zero()) -> None
…nctions

This prevents any cpp scoping in docstrings
@MatthijsBurgh
Copy link
Collaborator Author

@meyerj @smits your input would be really helpful. @jf--- and @zchen24 already did some reviewing.

As @jf--- mentioned it might be good to add an extra maintainer. I am interested in it.

@smits
Copy link
Member

smits commented May 4, 2020

@MatthijsBurgh , thanks a lot for all you effort. I'll add you as an extra maintainer so you can move on with merging and releasing your stuff. Both me and @meyerj are quite busy with other stuff, so adding a maintainer makes total sense to me.

Copy link
Member

@smits smits left a comment

Choose a reason for hiding this comment

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

If this entire PR gets merged as is we'll break the API due to the Joint::None --> Joint::Fixed change, this means we effectively need to create a new major number release since we are following the semantic versioning here, which seems a pitty for such a minor API breaking change. I'm not sure this is worth it. All other changes LGTM . Also if we want to release for ROS all of this can only go into the next ROS release and we cannot rerelease in any exisiting ROS distro.

@@ -317,7 +352,7 @@ void VectorVel::ReverseSign() {
}
doubleVel VectorVel::Norm() const {
double n = p.Norm();
return doubleVel(n,dot(p,v)/n);
return doubleVel(n,n ? dot(p,v)/n : 0); // Setting norm of p to 0 in case norm of v is 0
Copy link
Member

Choose a reason for hiding this comment

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

Comparing against exactly zero here, it might help to compare against eps if you want to prevent Inf, but in that case you might want to set n to zero as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will look into this.

Copy link
Collaborator Author

@MatthijsBurgh MatthijsBurgh May 4, 2020

Choose a reason for hiding this comment

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

@smits please check a6fbd38 and 9ec544e for my fix. The default argument has also been added to PyKDL.
Do you think this is the correct way?

@MatthijsBurgh
Copy link
Collaborator Author

MatthijsBurgh commented May 4, 2020

@smits The API is not broken, as None still available in kdl,

typedef enum { RotAxis,RotX,RotY,RotZ,TransAxis,TransX,TransY,TransZ,Fixed,None=Fixed} JointType;
I just made Fixed the new "default" to get rid of the legacy in the future.
Also None is still available in the python 2 API of PyKDL. So only in python 3 is not available, but that has not been released yet. So nothing to break yet.

@smits
Copy link
Member

smits commented May 4, 2020

@MatthijsBurgh , I missed that part 👍 . In that case I think this is in really good shape.

@MatthijsBurgh MatthijsBurgh merged commit 57736e2 into orocos:master May 6, 2020
@zchen24
Copy link
Contributor

zchen24 commented May 6, 2020

@MatthijsBurgh Congrats for pushing this through.

@MatthijsBurgh
Copy link
Collaborator Author

@zchen24 It started with your work, which was a good starting point.

@jf---
Copy link
Contributor

jf--- commented May 7, 2020

Congrats @MatthijsBurgh & wonderful to see the team of maintainers expanded!

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

Successfully merging this pull request may close these issues.

python-sip dependency Build Error during make PyBind11 instead of SIP
5 participants