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

Revision history [back]

click to hide/show revision 1
initial version

After rewatching my code I noticed, that the project I build around the ZED SDK was basically already some sort of wrapper itself. Noticing that I tried to make it work itself with catkin, rather than writing something else instead.

How?

Well, turns out when you work with a CMakeLists you should really get to know that file.. I remade it several times, without success and then googled every single line, and thought about it with a colleague (I cannot stress enough how much of a help another mind in this is, when you are not that familiar with catkin..)

Today I revisited my CMakeList and commented in and out every single package and line to see whether I included some not crucial stuff. Re-ordered it (as there are lots of people in the internet that tell you to include or find_package in the end of the file.. turns out that was unnecessary for me. So now I am ready to go with a fresh looking file.

Just because I'd like to see additional code fragments myself if I had this kind of error:

project(name LANGUAGES CXX CUDA)

Didn't find mine, so here goes

set(OpenCV_DIR __path__)

included some ROS-Packages here, if you do not need any of them, just throw them out

find_package(catkin REQUIRED COMPONENTS roscpp rosconsole nodelet image_transport sensor_msgs stereo_msgs std_msgs )

Other important stuff, like ZED, CUDA, OpenCV, ...

find_package(__other stuff__)

almost the same as with the catkin components

catkin_package( INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} CATKIN_DEPENDS roscpp rosconsole sensor_msgs stereo_msgs image_transport )

Not necessary, but I do not like to have paths to files in my lists..

set(NODE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)

All packages you need again..

include_directories( ${catkin_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS} ${ZED_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR} ${GLEW_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} )

Again, no paths for me please

FILE(GLOB CUDA_FILES cu/*.cu)

If you use cuda, just put everything here, works just fine. You probably could split it, but the computer seems to know which actual compiler to use I guess, the files have explicit endings..

cuda_add_executable(fire_detection ${NODE_SRC} ${CUDA_FILES})

Important again

TARGET_LINK_LIBRARIES(fire_detection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${GLUT_LIBRARIES} ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${ZED_LIBRARIES} )


I ommited these:

set(CUDA_ARCH_BIN " 30 " CACHE STRING "Specify 'real' GPU arch to build binaries for, BIN(PTX) format is supported. Example: 1.3 2.1(1.3) or 13 21(13)")

set(CUDA_ARCH_PTX "" CACHE STRING "Specify 'virtual' PTX arch to build PTX intermediate code for. Example: 1.0 1.2 or 10 12")

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;-std=c++11")

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "--ftz=true;--prec-div=false;--prec-sqrt=false; -rdc=true")

as they are used by CUDA_COMPILE - if I am not mistaken - and the compiling "just works". This may be the case for me, but it might not for you, so just letting you know.

Wth my beautiful lack of knowledge I figured this now very clean file (and the according package.xml) should be able to be automatically generated by a smart piece of software, but maybe not for more complex ones - if someone knows, please let me know.

It is working for me now, so I'll close this one.

After rewatching my code I noticed, that the project I build around the ZED SDK was basically already some sort of wrapper itself. Noticing that I tried to make it work itself with catkin, rather than writing something else instead.

How?

Well, turns out when you work with a CMakeLists you should really get to know that file.. I remade it several times, without success and then googled every single line, and thought about it with a colleague (I cannot stress enough how much of a help another mind in this is, when you are not that familiar with catkin..)

Today I revisited my CMakeList and commented in and out every single package and line to see whether I included some not crucial stuff. Re-ordered it (as there are lots of people in the internet that tell you to include or find_package in the end of the file.. turns out that was unnecessary for me. So now I am ready to go with a fresh looking file.

Just because I'd like to see additional code fragments myself if I had this kind of error:

project(name LANGUAGES CXX CUDA)

Didn't CUDA) #Didn't find mine, so here goes

goes set(OpenCV_DIR __path__)

__path__) # included some ROS-Packages here, if you do not need any of them, just throw them out

out find_package(catkin REQUIRED COMPONENTS roscpp rosconsole nodelet image_transport sensor_msgs stereo_msgs std_msgs )

) # Other important stuff, like ZED, CUDA, OpenCV, ...

... find_package(__other stuff__)

stuff__) # almost the same as with the catkin components

components catkin_package( INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} CATKIN_DEPENDS roscpp rosconsole sensor_msgs stereo_msgs image_transport )

) # Not necessary, but I do not like to have paths to files in my lists..

lists.. set(NODE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)

All ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp) #All packages you need again..

again.. include_directories( ${catkin_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS} ${ZED_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR} ${GLEW_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} )

) # Again, no paths for me please

please FILE(GLOB CUDA_FILES cu/*.cu)

cu/*.cu) # If you use cuda, just put everything here, works just fine. You probably could split it, but the computer seems to know which actual compiler to use I guess, the files have explicit endings..

endings.. cuda_add_executable(fire_detection ${NODE_SRC} ${CUDA_FILES})

Important again

${CUDA_FILES}) #Important again TARGET_LINK_LIBRARIES(fire_detection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${GLUT_LIBRARIES} ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${ZED_LIBRARIES} )

)

I ommited these:

set(CUDA_ARCH_BIN
#set(CUDA_ARCH_BIN " 30 " CACHE STRING "Specify 'real' GPU arch to build binaries for, BIN(PTX) format is supported. Example: 1.3 2.1(1.3) or 13 21(13)")

set(CUDA_ARCH_PTX 21(13)") #set(CUDA_ARCH_PTX "" CACHE STRING "Specify 'virtual' PTX arch to build PTX intermediate code for. Example: 1.0 1.2 or 10 12")

set(CUDA_NVCC_FLAGS 12") #set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;-std=c++11")

set(CUDA_NVCC_FLAGS "-Xcompiler;-fPIC;-std=c++11") #set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "--ftz=true;--prec-div=false;--prec-sqrt=false; -rdc=true")

-rdc=true")

as they are used by CUDA_COMPILE - if I am not mistaken - and the compiling "just works". This may be the case for me, but it might not for you, so just letting you know.

Wth my beautiful lack of knowledge I figured this now very clean file (and the according package.xml) should be able to be automatically generated by a smart piece of software, but maybe not for more complex ones - if someone knows, please let me know.

It is working for me now, so I'll close this one.

After rewatching my code I noticed, that the project I build around the ZED SDK was basically already some sort of wrapper itself. Noticing that I tried to make it work itself with catkin, rather than writing something else instead.

How?

Well, turns out when you work with a CMakeLists you should really get to know that file.. I remade it several times, without success and then googled every single line, and thought about it with a colleague (I cannot stress enough how much of a help another mind in this is, when you are not that familiar with catkin..)

Today I revisited my CMakeList and commented in and out every single package and line to see whether I included some not crucial stuff. Re-ordered it (as there are lots of people in the internet that tell you to include or find_package in the end of the file.. turns out that was unnecessary for me. So now I am ready to go with a fresh looking file.

Just because I'd like to see additional code fragments myself if I had this kind of error:

project(name LANGUAGES CXX CUDA)

#Didn't find mine, so here goes
set(OpenCV_DIR __path__)

# included some ROS-Packages here, if you do not need any of them, just throw them out
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rosconsole
  nodelet
  image_transport
  sensor_msgs
  stereo_msgs
  std_msgs
)
# Other important stuff, like ZED, CUDA, OpenCV, ...
find_package(__other stuff__)
# almost the same as with the catkin components
catkin_package(
  INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS}
  CATKIN_DEPENDS
    roscpp
    rosconsole
    sensor_msgs
    stereo_msgs
    image_transport
)
# Not necessary, but I do not like to have paths to files in my lists..
set(NODE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)

#All packages you need again..
include_directories(
        ${catkin_INCLUDE_DIRS}
        ${CUDA_INCLUDE_DIRS}
        ${ZED_INCLUDE_DIRS}
    ${OpenCV_INCLUDE_DIRS}
    ${GLUT_INCLUDE_DIR}
    ${GLEW_INCLUDE_DIRS} 
    ${OPENGL_INCLUDE_DIRS}
)

# Again, no paths for me please
FILE(GLOB CUDA_FILES cu/*.cu)
# If you use cuda, just put everything here, works just fine. You probably could split it, but the computer seems to know which actual compiler to use I guess, the files have explicit endings..
cuda_add_executable(fire_detection cuda_add_executable(name ${NODE_SRC} ${CUDA_FILES})

#Important again
TARGET_LINK_LIBRARIES(fire_detection TARGET_LINK_LIBRARIES(name 
    ${catkin_LIBRARIES}
    ${OpenCV_LIBRARIES}
    ${GLUT_LIBRARIES}
    ${GLEW_LIBRARIES}
    ${OPENGL_LIBRARIES}
    ${ZED_LIBRARIES}
)

I ommited these:

#set(CUDA_ARCH_BIN " 30 " CACHE STRING "Specify 'real' GPU arch to build binaries for, BIN(PTX) format is supported. Example: 1.3 2.1(1.3) or 13 21(13)")
#set(CUDA_ARCH_PTX "" CACHE STRING "Specify 'virtual' PTX arch to build PTX intermediate code for. Example: 1.0 1.2 or 10 12")    
#set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}  "-Xcompiler;-fPIC;-std=c++11")
#set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "--ftz=true;--prec-div=false;--prec-sqrt=false; -rdc=true")

as they are used by CUDA_COMPILE - if I am not mistaken - and the compiling "just works". This may be the case for me, but it might not for you, so just letting you know.

Wth my beautiful lack of knowledge I figured this now very clean file (and the according package.xml) should be able to be automatically generated by a smart piece of software, but maybe not for more complex ones - if someone knows, please let me know.

It is working for me now, so I'll close this one.