Importing generated code (.so) inside a rospy node
Hi,
I am using CVPYGEN to generate code to solve an optimisation problem. In order to run it (using its python wrapper) I simply need to import it like:
from testcodegen.cpgsolver import cpgsolve
However, when using ROS it seems that I cannot simply import from another python module, but I need to create a different package which contains the given module and import from that package. I have done that (and created a setup.py in the new package) and seems to be able to run the above line. However, inside the cpg_solver module, the following is called:
from testcodegen import cpg_module
Where cpgmodule refers to a **cpgmodule.cpython-37m-x8664-linux-gnu.so** file. My problem is that this import fails (ImportError: cannot import name 'cpgmodule').
Is the problem because of the .so file import? If so, how can I actually make it work? Am I completely wrong in my approach to this? The idea is to create a ROS service which executes the solver and returns the solution to be used by my other ROS nodes.
Asked by botboy on 2022-08-01 07:48:23 UTC
Comments