ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

ImportError for .cfg file when trying to run a node in ROS Kinetic

asked 2017-06-23 23:12:15 -0500

nemesis gravatar image

I have a .cfg file defined and set as executable in a /config folder which I have added in my CMakeList.txt as well.

In my node's python script, when I try to import the .cfg file to access some of the config parameters in a callback function for dynamic_reconfigure, I get the "No Module Named Pcl.cfg"

I am blank on what could be the problem here. Is there something else I need to specify somewhere? Like in my CMakeList?

I am trying to port some C++ code to Python, so utilizing a CMake for the node which is originally written in C++. So maybe I am missing something, but not sure what.

Would appreciate any guidance! Let me know if you need more information.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2017-06-27 18:53:58 -0500

nemesis gravatar image

The issue was the import statement.

My .cfg file was named Pcl.cfg

And had the following in it - exit(gen.generate(PACKAGE, "test_package", "Pcl"))

I thought, as per the tutorials, I should import it based on the 3rd argument above.

So my import statement was from Pcl.cfg import PclConfig

Which was wrong. It was instead supposed to be - from test_package.cfg import PclConfig

My fault for not thoroughly going through the tutorial on this one.

edit flag offensive delete link more

Comments

1

Thank you for this. The tutorials are super misleading.

Jägermeister gravatar image Jägermeister  ( 2019-03-20 05:09:08 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-06-23 23:12:15 -0500

Seen: 1,639 times

Last updated: Jun 27 '17