Ask Your Question
0

How do i open ros package on qtcreator

asked 2017-03-08 03:26:06 -0500

breeze6478 gravatar image

I made a Ros package. And I will try to open the package with Qt. However, I get the following type of error.

-- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:59 (message): find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.

-- Configuring incomplete, errors occurred! See also "/home/navi/catkin_ws/build/CMakeFiles/CMakeOutput.log".

And my package CMakeList is as follows.

cmake_minimum_required(VERSION 2.8.3)
project(multi_xtion)

find_package(catkin REQUIRED COMPONENTS   image_transport   rosbag roscpp   sensor_msgs   std_msgs  cv_bridge )
set(CMAKE_BUILD_TYPE "release")
LIST(APPEND SEARCH_LIBS /usr/lib)
LIST(APPEND SEARCH_LIBS /usr/local/lib) 
LIST(APPEND> SEARCH_LIBS /opt/local/lib)
LIST(APPEND SEARCH_LIBS /usr/lib/x86_64-linux-gnu)
LIST(APPEND SEARCH_HEADERS /usr/include) 
LIST(APPEND SEARCH_HEADERS /opt/include)
LIST(APPEND SEARCH_HEADERS /usr/include/eigen3)
LIST(APPEND SEARCH_HEADERS /opt/include/eigen3)
LIST(APPEND SEARCH_HEADERS /usr/local/include) 
LIST(APPEND SEARCH_HEADERS /opt/local/include)
LIST(APPEND SEARCH_HEADERS /usr/local/include/eigen3)
LIST(APPEND SEARCH_HEADERS /opt/local/include/eigen3)

message("-- Check for Google Flags")
find_library(GFLAGS_LIB NAMES gflags PATHS ${SEARCH_LIBS})
find_path(GFLAGS_INCLUDE NAMES gflags/gflags.h PATHS ${SEARCH_HEADERS})
include_directories(${GFLAGS_INCLUDE})

find_path(EIGEN_INCLUDE NAMES Eigen/Core PATHS ${SEARCH_HEADERS})

include_directories(${EIGEN_INCLUDE})
find_package(Ceres REQUIRED)
message("CERES_INCLUDE_DIRS: " ${CERES_INCLUDE_DIRS})
message("CERES_LIBRARIES: " ${CERES_LIBRARIES})
include_directories(${CERES_INCLUDE_DIRS})

IF (NOT "${OpenCV_DIR}" EQUAL "")
     MESSAGE("Using OpenCV from " ${OpenCV_DIR}) 
ENDIF (NOT "${OpenCV_DIR}" EQUAL "")

find_package(OpenCV 3.2 REQUIRED core imgproc highgui imgcodecs xfeatures2d PATHS "/usr/share/local/OpenCV")
MESSAGE("Using OpenCV from " ${OpenCV_INCLUDE_DIRS})
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIBRARY_DIRS})

find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
include_directories(${GLFW_INCLUDE_DIRS})
message("GLFW_INCLUDE_DIRS: " ${GLFW_INCLUDE_DIRS})
message("GLFW_LIBRARIES: " ${GLFW_LIBRARIES})

catkin_package()
include_directories( ${catkin_INCLUDE_DIRS})

add_executable(multi_xtion src/multi_xtion.cpp)
add_dependencies(multi_xtion ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(multi_xtion ${OpenCV_LIBS} ${catkin_LIBRARIES})
target_link_libraries(extrinsic_calib ${OpenCV_LIBS} ${GFLAGS_LIB} ${CERES_LIBRARIES} $catkin_LIBRARIES} -lGL -lGLU ${GLFW_LIBRARIES})
install(TARGETS multi_xtion
    RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Catkin_make works fine. What's wrong with qt-cmake?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-04-12 17:44:25 -0500

try setting in the cmake configuration (tools> options> Kits > (your kit) > cmake configuration) and be sure to start qtcreator from a bash with the ros environment configured

CATKIN_DEVEL_PREFIX:STRING=/home/<username>/catkin_ws/devel CATKIN_INSTALL_PREFIX:STRING=/home/<username>/catkin_ws/install CMAKE_PREFIX_PATH:STRING=/home/<username>/catkin_ws/devel;/opt/ros/kinetic CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}

edit flag offensive delete link more
1

answered 2017-03-08 03:47:52 -0500

mgruhler gravatar image

There is a Plugin for QT that typically sets up everything correctly and works like a charm. Have you tried this? https://github.com/ros-industrial/ros...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-03-08 03:26:06 -0500

Seen: 2,237 times

Last updated: Apr 12 '17