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

Add setter/getter for Pose's each element - Issue 35 #125

Merged
merged 15 commits into from
Jul 2, 2020

Conversation

pxalcantara
Copy link
Contributor

Solved #35

Add methods to Pose3.hh to get X,Y,Z,Roll,Pitch and Yaw directly, as suggested in the issue description :

  • pose.Pos.X() -> pose.X()
  • pose.Pos.Y() -> pose.Y()
  • pose.Pos.Z() -> pose.Z()
  • pose.Rot.Roll() -> pose.Roll()
  • pose.Rot.Pitch() -> pose.Pitch()
  • pose.Rot.Yaw() -> pose.Yaw()

@pxalcantara
Copy link
Contributor Author

@chapulina Here we go! first PR!! \o/

@chapulina chapulina added enhancement New feature or request 🏰 citadel Ignition Citadel 📜 blueprint Ignition Blueprint 🔮 dome Ignition Dome labels Jun 8, 2020
Copy link
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.

Thanks for the PR! ✌️ It's looking good. My only suggestion would be to also add tests for the mutable functions. I think the current tests are only covering the const ones.

Here's an example:

https://github.com/ignitionrobotics/ign-math/blob/fdbd226d70885e85e265d7c61cfa9014bee1a33a/src/Color_TEST.cc#L187-L194

src/Pose_TEST.cc Outdated Show resolved Hide resolved
@scpeters
Copy link
Member

are you able to merge this branch with ign-math6? it is currently out of date with the base branch

@pxalcantara
Copy link
Contributor Author

[DO NOT MERGE] @chapulina @scpeters
This code is not finished. The approach used to implement the mutable X(), Y() and Z() can not be used in Roll(), Pitch() and Yaw(). When this approach is used I got these errors:

RPY_error

That is expected because the Quaternion.Roll() , Pitch() and Yaw() are const : https://github.com/ignitionrobotics/ign-math/blob/ca49e983bc3939b6626e78f036ff5ea9bf10d270/include/ignition/math/Quaternion.hh#L423

How should I solve this point? I thought in some ways but, all of them I need to edit the library Quaternion.hh and, also, there is pattern and architecture questions, so I decided to ask

@chapulina
Copy link
Contributor

humm nice catch

In fact, this reminds me that we've been deprecating the mutable accessors in favor of Set* functions, see the Migration guide and issue #101 .

So I think the solution is to substitute the mutable functions with Set versions.

@pxalcantara
Copy link
Contributor Author

pxalcantara commented Jun 22, 2020

Humm, nice, so, maybe, stop working with this issue and help with this functionality of the Quaternion.hh ? After that continue to working here?

The idea is, also, to use this code style to Pose.hh and Vector3.hh ?

@chapulina
Copy link
Contributor

Oh I don't think you need to address the entire issue. I'd just change the new functions you're adding. Remove all the mutable functions and add:

Pose3d::SetX
Pose3d::SetY
Pose3d::SetZ
Pose3d::SetRoll
Pose3d::SetPitch
Pose3d::SetYaw

@pxalcantara
Copy link
Contributor Author

Ok, good, should I remove Pos() and Rot() mutable, as well, and change for SetPos() and SetRot(), or is it better to do this in another PR?

@chapulina
Copy link
Contributor

should I remove Pos() and Rot() mutable, as well, and change for SetPos() and SetRot()

Good call, yes, please!

@scpeters
Copy link
Member

Ok, good, should I remove Pos() and Rot() mutable, as well, and change for SetPos() and SetRot(), or is it better to do this in another PR?

those API's are already released in ign-math6, so I wouldn't remove them in this PR

@chapulina
Copy link
Contributor

those API's are already released in ign-math6, so I wouldn't remove them in this PR

Ah sorry, thank you Steve. Let's only remove the ones being added by this PR.

@scpeters
Copy link
Member

This code is not finished. The approach used to implement the mutable X(), Y() and Z() can not be used in Roll(), Pitch() and Yaw().

Quaternion doesn't allow modification of Euler angles independently; it only allows them to all be set at once. I would suggest simply adding Get functions for roll, pitch, yaw in this PR and address setting them in a separate pull request

@pxalcantara
Copy link
Contributor Author

This code is not finished. The approach used to implement the mutable X(), Y() and Z() can not be used in Roll(), Pitch() and Yaw().

Quaternion doesn't allow modification of Euler angles independently; it only allows them to all be set at once. I would suggest simply adding Get functions for roll, pitch, yaw in this PR and address setting them in a separate pull request

Ok, It was I thought, and also using the Euler method would not be a good idea now since it is deprecated, so I'll do your suggestion!
Thanks @scpeters and @chapulina

@pxalcantara
Copy link
Contributor Author

@scpeters @chapulina sorry for the delay. Is this the way that you suggested? About the failure of the CI test, I couldn't understand the error, what should I do to fix it?

@scpeters
Copy link
Member

scpeters commented Jul 1, 2020

it looks like the build machines had an error; I'll start the jobs again

@scpeters
Copy link
Member

scpeters commented Jul 1, 2020

@osrf-jenkins run tests please

@pxalcantara
Copy link
Contributor Author

Thank you @scpeters!

Copy link
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.

Looks great, thanks for iterating, @pxalcantara !

@chapulina chapulina merged commit 1e6f11d into gazebosim:ign-math6 Jul 2, 2020
@pxalcantara pxalcantara deleted the issue_35 branch July 2, 2020 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📜 blueprint Ignition Blueprint 🏰 citadel Ignition Citadel 🔮 dome Ignition Dome enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants