Skip to content

urdf_model: don't use or define M_PI - #38

Merged
scpeters merged 1 commit into
ros:masterfrom
scpeters:no_M_PI
Oct 26, 2017
Merged

scpeters merged 1 commit into
ros:masterfrom
scpeters:no_M_PI

Conversation

@scpeters

@scpeters scpeters commented Aug 3, 2017

Copy link
Copy Markdown
Contributor

Just use a local variable instead. This is an alternative to #34.

cc @Karsten1987

@scpeters scpeters mentioned this pull request Aug 3, 2017
@Karsten1987

Copy link
Copy Markdown

i wonder though what happens to existing user code. Let's say people include this pose.h relying on the M_PI definition in this file, they have to touch their code.

@scpeters

scpeters commented Aug 3, 2017

Copy link
Copy Markdown
Contributor Author

That's true, but I don't think it's entirely our problem. We could wait for a change in major version number if we wanted to be conservative.

@scpeters

Copy link
Copy Markdown
Contributor Author

@clalancette @sloretz any thoughts?

@sloretz sloretz left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

If not breaking any users who are using the math definitions is important the macro definition could be left in.

The change to use const double pi_2 should be merged regardless. If I understand correctly the current code is broken on windows if a user includes <cmath> before including urdf_model/pose.h. The _USE_MATH_DEFINES macro would not be set when it is evaluated in <cmath>.

@clalancette clalancette left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @sloretz assessment. Users really shouldn't be depending on urdf_model/pose.h to bring in M_PI for them anyway, so I think it is fine to remove _USE_MATH_DEFINES.

@scpeters
scpeters merged commit ed597eb into ros:master Oct 26, 2017
@scpeters
scpeters deleted the no_M_PI branch October 26, 2017 23:41
sloretz referenced this pull request in ros2/urdfdom_headers Feb 22, 2018
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.

4 participants