How to run cv_bridge?
hi , i want to run cv_bridge, so i refer to Converting between ROS images and OpenCV images (C++) i did every thing were told at" An example ROS node" at the end i added the commad below to the end of CMakelist.txt and after that run catkin_make
add_executable(image_converter src/image_converter.cpp)
target_link_libraries(image_converter ${catkin_LIBRARIES})
add_dependencies(image_converter beginner_tutorials_generate_messages_cpp)
but i have 2 problems : 1. when i run catkin_make i receive this error :
CMake Error: Error in cmake code at
/home/fatima/catkin_ws3/src/beginner_tutorials/CMakeLists.txt:135:
Parse error. Expected a command name, got unquoted argument with text "/add_executable".
- and if it can be run , how to run image_converter file and how to see the result of cv_bridge ?
hi thnks for reply , this is my CMakelists: i dont know is it true for cv_bridge or not?
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
rospy
sensor_msgs
std_msgs
genmsg message_generation
)
add_message_files(FILES Num.msg )
add_service_files(FILES AddTwoInts.srv)
generate_messages(
DEPENDENCIES
sensor_msgs
cv_bridge
roscpp
std_msgs
image_transport
)
generate_messages(DEPENDENCIES std_msgs)
catkin_package( INCLUDE_DIRS include
LIBRARIES ${beginner_tutorials} CATKIN_DEPENDS message_runtime roscpp nodelet)
catkin_package( )
include_directories(
${catkin_INCLUDE_DIRS}
)
catkin_package()
add_library()/add_executable()/target_link_libraries(
add_library(beginner_tutorials
src/${PROJECT_NAME}/beginner_tutorials.cpp
)
add_dependencies(beginner_tutorials ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(beginner_tutorials_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(beginner_tutorials_node
${catkin_LIBRARIES}
)
add_executable(image_converter src/image_converter.cpp)
target_link_libraries(image_converter ${catkin_LIBRARIES})
add_dependencies(image_converter beginner_tutorials_generate_messages_cpp)
And now after fixing the last problem i have again another problem with generate_messages : CMakeLists :
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
rospy
sensor_msgs
std_msgs
genmsg message_generation
)
################################################
## Declare ROS messages, services and actions ##
################################################
## Generate messages in the 'msg' folder
add_message_files(FILES Num.msg )
add_service_files(FILES AddTwoInts.srv)
## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )
## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
sensor_msgs
cv_bridge
roscpp
std_msgs
image_transport
# sensor_msgs# std_msgs
)
##generate_messages(DEPENDENCIES std_msgs)
catkin_package( INCLUDE_DIRS include
LIBRARIES ${beginner_tutorials} CATKIN_DEPENDS message_runtime roscpp nodelet)
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
catkin_package()
##add_library()/add_executable()/target_link_libraries()
## Declare a C++ library
add_library(beginner_tutorials
src/${PROJECT_NAME}/beginner_tutorials.cpp
)
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
add_dependencies(beginner_tutorials ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Declare a C++ executable
# add_executable(beginner_tutorials_node src/beginner_tutorials_node.cpp)
## Add cmake target dependencies of the executable
## same as for the library above
add_dependencies(beginner_tutorials_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
target_link_libraries(beginner_tutorials_node
${catkin_LIBRARIES}
)
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_beginner_tutorials.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
add_executable(image_converter src/image_converter.cpp)
target_link_libraries(image_converter ${catkin_LIBRARIES})
add_dependencies(image_converter beginner_tutorials_generate_messages_cpp)
and this is my catkin_make Error :
Base path: /home/fatima/catkin_ws3
Source space: /home/fatima/catkin_ws3/src
Build space: /home/fatima/catkin_ws3/build
Devel space: /home/fatima/catkin_ws3/devel
Install space: /home/fatima/catkin_ws3/install
####
#### Running command: "make ...
Is the code you are trying to compile in the beginner_tutorials package or in another? Because it seems to me that the problem is with the beginner_tutorials package... Just a thought...