Skip to content

Conversation

@SteveNguyen
Copy link

trac_ik_python bindings:

  • used the catkin-to-ament script to convert the CMakeLists, plus some tinkering
  • changed from rospy to rclpy
  • removed the reading of robot_description from parameters

I now stumble upon a SWIG error:
This warning: "trac_ik/trac_ik_python/swig/trac_ik_wrap.i:298: Warning 303: %extend defined for an undeclared class TRAC_IK::TRAC_IK."
probably leads to the cascade of errors I got:
"build/trac_ik_python/CMakeFiles/_trac_ik_wrap.dir/trac_ik_wrapPYTHON_wrap.c:13463:24: error: ‘temp’ was not declared in this scope
13463 | TRAC_IK_PUBLIC * temp;" ...
My understanding is that SWIG does not find the TRAC_IK class, maybe due to a namespace problem?

I tried with a very basic trac_ik_wrap.i with just the include to expose the class and got the same error.

@aprotyas
Copy link
Owner

Thanks for opening this PR! I have some minimal progress in #4 that I can fold into this too, do you mind if I push commits to this branch?

About the actual problem you're facing, I should have some time to investigate into this over the next couple of days. I will report back once I understand how SWIG actually works. I suspect the problem is something to do with the trac_ik class changing? But that's just a hunch...

@aprotyas aprotyas changed the title trying to get the python wrapper compile... wip [trac_ik_python]: Add suport for ROS 2 Aug 10, 2021
This was referenced Aug 10, 2021
@SteveNguyen
Copy link
Author

Well, I experimented a little bit and it seems that the include: "%include <trac_ik/trac_ik.hpp>" in trac_ik_wrap.i already confuses swig. If I comment this line I can get the package compile but of course, the wrapper is incomplete.

@aprotyas
Copy link
Owner

I wonder whether it's because I didn't export things correctly on the trac_ik_lib end, but that would manifest as a problem earlier through trac_ik_examples anyway. Any clue what's happening?

@SteveNguyen
Copy link
Author

Ok so I have tried some various things and it seems that the TRAC_IK namespace may be a problem (https://stackoverflow.com/questions/15778870/swig-namespace-error-not-a-valid-base-class) a namespace with the same name as the class may create problems.
Secondly, it seems that the TRAC_IK_PUBLIC macros in trac_ik_lib visibility_control.hpp also breaks stuff.
But I still did not find something working...

@aprotyas
Copy link
Owner

aprotyas commented Aug 13, 2021

Apologies for the lack of activity here.

Namespacing

Wasn't it always like this though? As in, even in the ROS 1 package, the namespace was still like this no? I'm not sure what would cause a regression here. 😕


Visibility control

Yes, the visibility control macros were introduced because ROS 2 treats the Windows platform as a first class citizen, so I wanted this package to be cross-platform.

Do you mind checking if this recommendation is actionable and/or relevant for the swig stuff happening in this package? https://sourceforge.net/p/swig/mailman/message/35356996/

I will also be looking at it over the weekend hopefully, so don't feel pressed!

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.

3 participants