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

adding a python node that uses opencv - ROS Indigo

asked 2015-04-22 16:57:40 -0500

voladoddi gravatar image

I followed this guide http://rodrigoberriel.com/2014/10/ins... for setting up OpenCV for ROS Indigo (since it doesn't come bundled anymore).

Now, the problem is I don't have an executable node that is produced from a CPP source file for target_link_libraries but I have a python node that uses OpenCV.

After adding 1)

all the dependencies in "package.xml" file,

and 2)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(${OpenCV_LIBS})

in the CMakeLists.txt file, I get this error:

CMake Error at HELLO_WORLD/CMakeLists.txt:168 (target_link_libraries):
  Cannot specify link libraries for target "HELLO_WORLD" which is not built
  by this project.

How do I resolve this issue? Other nodes written in Python, I can just say "rosrun [PACKAGE_NAME] python_node.py" But in this Python node that uses OpenCV, I need to make changes appropriately in the CMakeLists.txt file. Only, I'm not quite sure what it is. sources I've referred to talk about CPP nodes.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-04-22 20:07:26 -0500

If you're only using OpenCV with python, you don't need to add anything in your CMakeLists.txt. As long as the python module is on your PYTHONPATH, you're all set.

edit flag offensive delete link more

Comments

Thanks! Yes, I realised that "import cv2" already exists in the code. And it was pointed about by another gentleman on another post as well but this makes it clear :)

voladoddi gravatar image voladoddi  ( 2015-04-23 12:39:27 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-04-22 16:57:40 -0500

Seen: 518 times

Last updated: Apr 22 '15