Ask Your Question
0

Why catkin do not generate message headers?

asked 2015-05-20 09:24:58 -0500

Dimeterious Fox gravatar image

updated 2015-05-21 09:44:16 -0500

I don't understand why, Catkin don't generate message headers. I have two packages. With one of them (ppl_detection) catkin works properly -- all headers are generated. But for another (ros_johnny5) -- it not works. Here CMakeList.txt for the both packages:

ppl_detection

cmake_minimum_required(VERSION 2.8.3)
project(ppl_detection)

set(CMAKE_BUILD_TYPE Debug)

find_package(catkin REQUIRED COMPONENTS 
    roscpp
    rospy
    std_msgs
    message_generation
    roslaunch
    tf
    pcl_ros
    laser_geometry
    visualization_msgs
    geometry_msgs
)

find_package(PCL)

add_message_files(
    FILES
    Human.msg
    Tracker.msg
)

generate_messages(
    DEPENDENCIES
    std_msgs
    geometry_msgs
    visualization_msgs
)

###################################
## catkin specific configuration ##
###################################

catkin_package(
    INCLUDE_DIRS include
    #  LIBRARIES ros_ssc32
    CATKIN_DEPENDS message_runtime
    #  DEPENDS system_lib
)

###########
## Build ##
###########

include_directories(
    ${catkin_INCLUDE_DIRS}
    ${PCL_INCLUDE_DIRS}
    include
)

add_library(ppl_detection 
    src/svm.cpp
    src/pca.cpp
    src/plyfile.c
)

add_executable(kinect_detect 
    src/kinect_detect.cpp
)

target_link_libraries(kinect_detect 
    ppl_detection
    ${catkin_LIBRARIES}
    ${PCL_LIBRARIES}
)

add_dependencies(kinect_detect
    ${PROJECT_NAME}_generate_messages_cpp
)

add_executable(train 
    src/train.cpp
)

target_link_libraries(train 
    ppl_detection
    ${catkin_LIBRARIES}
    ${PCL_LIBRARIES}
)

add_dependencies(train
    ${PROJECT_NAME}_generate_messages_cpp
)

add_executable(predict 
    src/predict.cpp
)

target_link_libraries(predict 
    ppl_detection
    ${catkin_LIBRARIES}
    ${PCL_LIBRARIES}
)

add_dependencies(predict
    ${PROJECT_NAME}_generate_messages_cpp
)

ros_johnny5

cmake_minimum_required(VERSION 2.8.3)
project(ros_johnny5)

set(CMAKE_BUILD_TYPE Debug)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS 
    roscpp
    rospy
    std_msgs
    roslaunch
    tf
    ppl_detection
    genmsg
    message_generation
)

################################################
## Declare ROS messages, services and actions ##
################################################

add_message_files(
    FILES
    servoMsg.msg
    servoMsgArray.msg
    robotState.msg
)

## Generate added messages and services with any dependencies listed here
generate_messages(
    DEPENDENCIES
    std_msgs
)

###################################
## catkin specific configuration ##
###################################

catkin_package(
    INCLUDE_DIRS inc
#   LIBRARIES ros_ssc32
    CATKIN_DEPENDS message_runtime std_msgs
#   DEPENDS system_lib
)

###########
## Build ##
###########

include_directories(
    ${catkin_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIRS}
    inc
)

## Declare a cpp executable

########## SSC32 NODE ##########

set(SSC32_HEADERS
    inc/ros_ssc32.h
)

set(SSC32_SOURCES
    src/ros_ssc32.cpp
)

add_executable(ros_ssc32
    ${SSC32_SOURCES}
    ${SSC32_HEADERS}
)

add_library(ros_ssc32_lib
    src/servo.cpp
    src/serial.cpp
    src/robot.cpp
)

target_link_libraries(ros_ssc32
    ${catkin_LIBRARIES}
    ${Boost_LIBRARIES}
    ros_ssc32_lib
)

add_dependencies(ros_ssc32
   ros_johnny5_generate_messages_cpp
)

########## SSC32 NODE END ##########

########## BAL NODE ##########

set(BAL_INCLUDES
    inc/johnny_life.h
)

set(BAL_SOURCES
    src/johnny_life.cpp
)

add_executable(johnny_life
    ${BAL_INCLUDES}
    ${BAL_SOURCES}
)

add_library(johnny_life_lib
    src/positions.cpp
)

target_link_libraries(johnny_life
    ${catkin_LIBRARIES}
    ${Boost_LIBRARIES}
    johnny_life_lib
)

add_dependencies(johnny_life
    ppl_detection_generate_messages_cpp
)

########## BAL NODE END ##########

########## TEST NODE ##########

set(TEST_INCLUDES
    inc/servo.h
    inc/serial.h
    inc/topics.h
    inc/robot.h
)

set(TEST_SOURCES
    src/test.cpp
    src/servo.cpp
    src/serial.cpp
    inc/topics.h
    src/robot.cpp
)

add_executable(test_node
    ${TEST_INCLUDES}
    ${TEST_SOURCES}
)

target_link_libraries(test_node
    ${catkin_LIBRARIES}
    ${Boost_LIBRARIES}
)

add_dependencies(test_node
   ros_johnny5_generate_messages_cpp
)
########## TEST NODE END ##########

########## TRACKING NODE ##########

set(TRACKING_INCLUDES
    inc/johnny_skeleton_tracking.h
    inc/raw_model.h
)

set(TRACKING_SOURCES
    src/johnny_skeleton_tracking.cpp
    src/raw_model.cpp
)

add_executable(tracking_node
    ${TRACKING_INCLUDES}
    ${TRACKING_SOURCES}
)

target_link_libraries(tracking_node
    ${catkin_LIBRARIES}
    ${Boost_LIBRARIES}
)

add_dependencies(tracking_node
   ros_johnny5_generate_messages_cpp
)

########## TRACKING NODE END ##########

edit retag flag offensive close merge delete

Comments

1

Can you provide the console output ? Dependency on genmsg is not necessary, only message_generation I think.

Cyril_J gravatar image Cyril_J  ( 2015-11-25 09:31:30 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-02-04 15:07:24 -0500

Dimeterious Fox gravatar image

Okey, I found it. I had to add the following lines:

add_dependencies(lib_name
    ros_johnny5_generate_messages_cpp
)

for each add_library() in ros_johnny5 CMakeFile.txt too, because I use messages of project in library too.

Completely, it's look like this:

add_library(your_lib
    src1.cpp
    src2.cpp
    ...
)
add_dependencies(your_lib
    your_project_generate_messages_cpp
)
edit flag offensive delete link more

Comments

Thanks a million! I fixed this issue https://github.com/rayvburn/ORB-SLAM2... by following your advice! It is never mentioned in catkin documentation on ROS website...

Wintermute gravatar image Wintermute  ( 2020-11-11 04:22:15 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2015-05-20 09:24:58 -0500

Seen: 1,948 times

Last updated: Feb 04 '16