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

custom ros package not detected after catkin_make

asked 2020-07-01 08:50:22 -0500

AntoineKuleba gravatar image

updated 2020-07-01 09:22:00 -0500

Hi guys,

I am working with openVino, and I am currently trying to integrate their sample code to ros (in a package that I called open_vino_try). So I changed the code in the cpp file, adding pub and sub, I added the essential things in the cmake and in the package.xml, and everything seems to compile fine:

-- ~~  traversing 5 packages in topological order:
-- ~~  - realsense2_description
-- ~~  - object_msgs
-- ~~  - open_vino_try
-- ~~  - opencv_tuto
-- ~~  - realsense2_camera


Scanning dependencies of target open_vino_try
[ 88%] Building CXX object open_vino_try/pedestrian_tracker_demo/CMakeFiles/open_vino_try.dir/main.cpp.o
[ 90%] Building CXX object open_vino_try/pedestrian_tracker_demo/CMakeFiles/open_vino_try.dir/src/cnn.cpp.o
[ 92%] Building CXX object open_vino_try/pedestrian_tracker_demo/CMakeFiles/open_vino_try.dir/src/kuhn_munkres.cpp.o
[ 92%] Building CXX object open_vino_try/pedestrian_tracker_demo/CMakeFiles/open_vino_try.dir/src/detector.cpp.o
[ 94%] Building CXX object open_vino_try/pedestrian_tracker_demo/CMakeFiles/open_vino_try.dir/src/distance.cpp.o
[ 95%] Building CXX object open_vino_try/pedestrian_tracker_demo/CMakeFiles/open_vino_try.dir/src/tracker.cpp.o
[ 97%] Building CXX object open_vino_try/pedestrian_tracker_demo/CMakeFiles/open_vino_try.dir/src/utils.cpp.o
[ 98%] Linking CXX executable /home/antoine/catkin_ws/devel/lib/open_vino_try/open_vino_try
[ 98%] Built target open_vino_try

But then I cannot run it through a rosrun, and actually the package does not appear anywhere, no matters the command. I obviously tried to source the devel every time but nothing changes.

The structure of my project is the following: I have my pkg (open_vino_try) which will hold many subfolders, corresponding to the different sample code from OpenVino (btw I am aware that ros packages already exist, but they didn't seem to work properly, and moreover I really want to know why it is not working). For now there is only one subfolder: pedestrian_tracker_demo. So I have a "big" CMakeLists at the root of my pkg which will call other CMakeLists in the different subfolder.

That the tree of my project:

  • open_vino_try (my package)
    • CMakeLists.txt
    • Package.xml
    • pedestrian_tracker_demo
      • CMakeLists.txt
      • src (folder)
      • include
      • main.cpp
    • (Other folder denpencies)

This is my CMakeFiles in the pkg root folder:

cmake_minimum_required(VERSION 3.0.2)

project(open_vino_try)

find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  roscpp
  sensor_msgs
  std_msgs
  rospy
)

catkin_package()

option(ENABLE_PYTHON "Whether to build extension modules for Python demos" OFF)

if (CMAKE_BUILD_TYPE STREQUAL "")
    message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used")
    set(CMAKE_BUILD_TYPE "Release")
endif()

if (NOT(BIN_FOLDER))
    string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH)
    if(ARCH STREQUAL "x86_64" OR ARCH STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
        set(ARCH intel64)
    elseif(ARCH STREQUAL "i386")
        set(ARCH ia32)
    endif()

    set (BIN_FOLDER ${ARCH})
endif()

if (NOT(IE_MAIN_SOURCE_DIR))
    # in case if samples are built out of IE repo
    set (IE_MAIN_SAMPLES_DIR ${CMAKE_CURRENT_BINARY_DIR})
else()
    # in case if samples are built from IE repo
    set (IE_MAIN_SAMPLES_DIR ${IE_MAIN_SOURCE_DIR})
endif()

if(NOT(UNIX))
    set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
    set (CMAKE_LIBRARY_PATH ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
    set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
    set (CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
    set (CMAKE_PDB_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
    #set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
    set (LIBRARY_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
    set (LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_DIRECTORY}) # compatibility issue: linux uses LIBRARY_OUTPUT_PATH, windows uses LIBRARY_OUTPUT_DIRECTORY
else ()
    set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
    set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER}/${CMAKE_BUILD_TYPE}/lib)
    set (CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR ...
(more)
edit retag flag offensive close merge delete

Comments

try source ~/.bashrc... I have to do that each time after I catkin build a new package.... otherwise it could not locate the new package

xibeisiber gravatar image xibeisiber  ( 2020-07-01 09:13:58 -0500 )edit

Hi, sorry I forgot to say that I did it everytime, and sourcing the devel/setup.bash, but nothing changes!

AntoineKuleba gravatar image AntoineKuleba  ( 2020-07-01 09:21:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-07-06 02:38:46 -0500

AntoineKuleba gravatar image

Well, after several days of trying everything, I finally found the issue.

For this particular package, I do not know why, but to allow the rosrun command to find my pkg, I have first to make a rospack depends1 pkg_name ( after sourcing the devel/setup obviously). This command succeeds in locating my package, and then it seems to update it and then allows me to run the command rosrun. It doesn't seem to be a normal process, does anyone have encounter such similar behavior?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-07-01 08:50:22 -0500

Seen: 729 times

Last updated: Jul 06 '20