Skip to content

Vector2, 3 and 4 with pybind11#280

Merged
ahcorde merged 32 commits into
ign-math6from
ahcorde/math/pybind11
Dec 16, 2021
Merged

Vector2, 3 and 4 with pybind11#280
ahcorde merged 32 commits into
ign-math6from
ahcorde/math/pybind11

Conversation

@ahcorde
Copy link
Copy Markdown
Contributor

@ahcorde ahcorde commented Nov 5, 2021

Signed-off-by: ahcorde ahcorde@gmail.com

🎉 New feature

Summary

This is a draft PR tothat create wrappers for Vector2, 3 and 4 with pybind11

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde self-assigned this Nov 5, 2021
@github-actions github-actions Bot added Gazebo 1️1️ Dependency of Gazebo classic version 11 🌱 garden Ignition Garden 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🏰 citadel Ignition Citadel 🔮 dome Ignition Dome labels Nov 5, 2021
@chapulina chapulina added the scripting Scripting interfaces to Ignition label Nov 5, 2021
@ahcorde
Copy link
Copy Markdown
Contributor Author

ahcorde commented Nov 15, 2021

I made some changes:

  • I changed a little bit the ruby/CMakeLists.txt to avoid collisions with the pybind11 target.
  • I'm getting pybind11 with FetchContent. we will be always compiling the python interfaces, should I need to add a CMAKE flag ?
  • I installed the SWIG version in lib/python/swig/ to avoid collisions with the two versions

@ahcorde ahcorde marked this pull request as ready for review November 15, 2021 23:44
@ahcorde ahcorde requested a review from scpeters as a code owner November 15, 2021 23:44
@ahcorde
Copy link
Copy Markdown
Contributor Author

ahcorde commented Nov 15, 2021

@scpeters or @chapulina this is ready for a initial review.

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 19, 2021

Codecov Report

Merging #280 (2f77fc0) into ign-math6 (af04dad) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           ign-math6     #280   +/-   ##
==========================================
  Coverage      99.65%   99.65%           
==========================================
  Files             67       67           
  Lines           6359     6359           
==========================================
  Hits            6337     6337           
  Misses            22       22           
Impacted Files Coverage Δ
include/ignition/math/Vector2.hh 100.00% <100.00%> (ø)
include/ignition/math/Vector3.hh 100.00% <100.00%> (ø)
include/ignition/math/Vector4.hh 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af04dad...2f77fc0. Read the comment docs.

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Copy link
Copy Markdown
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

This works seamlessly with the ign-gazebo PR, great work!

If we're going to switch from SWIG to pybind11, I think we need to:

  • Remove the Python SWIG bindings as we port them to pybind11. We shouldn't end up maintaining both
  • Make sure the pybind11 bindings are being installed correctly when we create debs
  • It would be nice not to waste all the effort we did to create SWIG bindings. How much effort do you think it would be to move them to the Ruby folder? We don't need to add tests, I think that would be too much work, right?

Comment thread include/ignition/math/Vector2.hh Outdated
Comment thread src/python_pybind11/CMakeLists.txt Outdated
Comment thread src/ruby/CMakeLists.txt
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde
Copy link
Copy Markdown
Contributor Author

ahcorde commented Dec 10, 2021

@scpeters this is ready for another review

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Comment thread src/python_pybind11/src/vector2.hh Outdated
Comment thread src/python_pybind11/src/Vector2.hh Outdated
Comment thread src/python_pybind11/src/Vector2.hh Outdated
Comment thread src/python_pybind11/src/Vector3.hh Outdated
Comment thread src/python_pybind11/src/Vector4.hh Outdated
Comment thread src/python_pybind11/src/Vector2.hh Outdated
Comment thread src/python_pybind11/src/Vector3.hh Outdated
Comment thread src/python_pybind11/src/Vector4.hh Outdated
Comment thread src/python_pybind11/test/Vector3_TEST.py Outdated
@ahcorde ahcorde requested a review from scpeters December 15, 2021 20:09
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Copy link
Copy Markdown
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

just some minor comments related to comments and doc-strings, looks good!

Comment thread src/python_pybind11/src/Vector3.hh Outdated
"Return the absolute dot product of this vector and "
"another vector. This is similar to the Dot function, except the "
"absolute value of each component of the vector is used.")
.def("abs", &Class::Abs, " Get the absolute value of the vector")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: leading whitespace in doc-string

Comment thread src/python_pybind11/src/Vector4.hh
Comment thread src/python_pybind11/src/Vector2.hh Outdated
Comment thread src/python_pybind11/CMakeLists.txt Outdated
Signed-off-by: ahcorde <ahcorde@gmail.com>
@ahcorde ahcorde requested a review from scpeters December 15, 2021 22:43
Copy link
Copy Markdown
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

looks great!

please edit the commit message when squash+merging, thanks!

@ahcorde ahcorde enabled auto-merge (squash) December 16, 2021 15:15
@ahcorde ahcorde requested a review from j-rivero December 16, 2021 15:21
@chapulina chapulina dismissed their stale review December 16, 2021 16:37

comments addressed

@ahcorde ahcorde merged commit b399035 into ign-math6 Dec 16, 2021
@ahcorde ahcorde deleted the ahcorde/math/pybind11 branch December 16, 2021 16:37
scpeters added a commit to scpeters/gz-math that referenced this pull request Dec 22, 2021
Ccreated wrappers for Vector2, 3 and 4 with pybind11

Signed-off-by: ahcorde <ahcorde@gmail.com>

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
scpeters added a commit to scpeters/gz-math that referenced this pull request Jan 10, 2022
Ccreated wrappers for Vector2, 3 and 4 with pybind11

Signed-off-by: ahcorde <ahcorde@gmail.com>

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
scpeters added a commit that referenced this pull request Jan 10, 2022
Ccreated wrappers for Vector2, 3 and 4 with pybind11

Signed-off-by: ahcorde <ahcorde@gmail.com>

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
@osrf-triage
Copy link
Copy Markdown

This pull request has been mentioned on Gazebo Community. There might be relevant details there:

https://community.gazebosim.org/t/new-ignition-releases-2022-03-01-citadel-edifice-fortress/1313/1

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

Labels

🏰 citadel Ignition Citadel 🔮 dome Ignition Dome 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🌱 garden Ignition Garden Gazebo 1️1️ Dependency of Gazebo classic version 11 scripting Scripting interfaces to Ignition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants