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

[indigo] IKFastTemplate: Fix compiler error because of isnan ambiguity. #586

Conversation

hartmanndennis
Copy link
Contributor

Fixes #584

@hartmanndennis hartmanndennis force-pushed the pr-indigo-ikfast-template-fix-compiler-error-isnan-ambiguity branch from c8994e5 to 0439f83 Compare August 10, 2017 14:53
Copy link
Member

@gavanderhoorn gavanderhoorn left a comment

Choose a reason for hiding this comment

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

Not very sophisticated perhaps, but a practical way to get around C++11 and IKFast problems for now.

@@ -136,8 +136,12 @@ enum IkParameterizationType
/// when serializing the ik parameterizations
};

// HACK to fix isnan ambiguity
Copy link
Member

Choose a reason for hiding this comment

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

While it is sort of a hack, it would be nice if we could call this a work around, as it works around what is currently a limitation of OpenRAVE/IKFast.

@@ -136,8 +136,12 @@ enum IkParameterizationType
/// when serializing the ik parameterizations
};

// HACK to fix isnan ambiguity
#undef isnan
Copy link
Member

Choose a reason for hiding this comment

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

Can you clarify why you added this additional undef?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isnan could be defined somewhere else and I thought redefining macros would throw an error but it's only a warning so maybe we want to get the warning.

@gavanderhoorn
Copy link
Member

I'm also wondering whether we could perhaps approach this differently: perhaps we could remove the #include of the generated .cpp from the template, make it a separate compilation target in the generated CMakeLists.txt and use set_target_properties(..) / target_compile_definitions(..) to alias isnan with std::isnan only in that particular target.

That would localise the effects of this as much as possible.

I'm not entirely sure why the .cpp was #included the way it is right now though. If it is for performance reasons (ie: inlining) other compiler/linker features could perhaps be used now that they have become available.

@davetcoleman: do you know why the generated source file is #included in the template?

@hartmanndennis hartmanndennis force-pushed the pr-indigo-ikfast-template-fix-compiler-error-isnan-ambiguity branch from 0439f83 to e66d292 Compare August 10, 2017 15:25
@gavanderhoorn
Copy link
Member

I have another fix/work-around for this that is a little less hacky and more maintainable.

I'll submit a PR for that later this week.

@v4hn
Copy link
Contributor

v4hn commented Aug 14, 2017

@gavanderhoorn I was about to +1 this when you posted the above comment just now.
Given the circumstances, I believe this is a reasonable solution and it's just 3LOC.
What do you propose instead?

@gavanderhoorn
Copy link
Member

@v4hn wrote:

What do you propose instead?

to make the create_ikfast_moveit_plugin.py post-process the generated c++ source and replace unqualified isnan calls with std::isnan where appropriate. That is a lot less of a shotgun approach to this, as #define will also override all other occurences of isnan, not just those local to the file.

@v4hn
Copy link
Contributor

v4hn commented Aug 14, 2017

to make the create_ikfast_moveit_plugin.py post-process the generated c++ source and replace unqualified isnan calls with std::isnan where appropriate. That is a lot less of a shotgun approach to this

You are right. I'm looking ahead to merge your working request :)

@davetcoleman
Copy link
Member

davetcoleman commented Aug 17, 2017

@gavanderhoorn I do not know why it was done this way. I once had a branch for the ikfast plugin that made all generated IKFast plugins depend upon moveit_kinematics package for all wrapper code around the one robot-specific generated file. If implemented, this would allow all IKFast plugins to be automatically updated whenever moveit_kinematics is updated. Just a slightly off-topic thought that involved moving this #include directive.

@gavanderhoorn
Copy link
Member

I remember discussing that approach before, yes.

The current way of doing things does mean that we have almost total freedom when it comes to breaking things, as existing plugins will not be affected in any way - they are completely stand-alone (as far as that is possible for plugins).

It does mean that upgrades - or desirable changes - do not get propagated easily.

@v4hn
Copy link
Contributor

v4hn commented Aug 27, 2017

@gavanderhoorn ping

@gavanderhoorn
Copy link
Member

I'll get back to this, had a EU project deadline.

@v4hn
Copy link
Contributor

v4hn commented Sep 26, 2017

closed in favor of #619

@v4hn v4hn closed this Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned someone is/should be currently working on this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants