SWIG conversion and TypeError (class typemap)

185 Views Asked by At

I'm trying to convert a simple .h file from c++ to python using swig.

The .i file is quite simple and it is:

%module conversions
%{
    #include "conversions.h"
%}

%include "typemaps.i"
%include "conversions.h"    

I'm able to convert the file from c++ and call it in python but when I'm trying to use one of the functions converted I have the following TypeError:

TypeError: in method 'msgToMap', argument 1 of type 'octomap_msgs::Octomap const &'

The input passed to this function when called is of type:

<class 'octomap_msgs.msg._Octomap.Octomap'>

and I know that the type is the same converted from C++ to Python. What I want to do is to say to SWIG or to python: Treat the type octomap_msgs.msg._Octomap.Octomap in python as octomap_msgs::Octomap const & when in C++.

I know that exists the typemaps.i library in swig but I don't really get how to use it in this context. How can I do that?

0

There are 0 best solutions below