Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 417

How to use custom defined messages in another package?

$
0
0
I am new to ros and was writing code to publish and listen to a custom message. I am running ROS kinetic on Debian machine. In my workspace I have two package - *aa* and *bb*. *aa* has a message `two_ints` as follows: int16 a1 int16 b1 Both the packages use this message. When I catkin_make my workspace I get the following error in source of bb: .../catkin_new/src/bb/src/src_bb.cpp:2:24: fatal error: aa/two_ints.h: No such file or directory The CMakeLists.txt of aa is cmake_minimum_required(VERSION 2.8.3) project(aa) find_package(catkin REQUIRED COMPONENTS roscpp std_msgs message_generation ) add_message_files( FILES two_ints.msg ) generate_messages( DEPENDENCIES std_msgs ) catkin_package( INCLUDE_DIRS include LIBRARIES aa CATKIN_DEPENDS roscpp std_msgs message_runtime ) include_directories( ${catkin_INCLUDE_DIRS} ) add_executable(talker src/src_aa.cpp) target_link_libraries(talker ${catkin_LIBRARIES}) add_dependencies(talker aa_generate_messages_cpp) And CMakeLists.txt of bb is cmake_minimum_required(VERSION 2.8.3) project(bb) find_package(catkin REQUIRED COMPONENTS roscpp std_msgs ) catkin_package( INCLUDE_DIRS include LIBRARIES bb CATKIN_DEPENDS roscpp std_msgs ) include_directories( ${catkin_INCLUDE_DIRS} ) add_executable(listener src/src_aa.cpp) target_link_libraries(listener ${catkin_LIBRARIES}) add_dependencies(listener aa_generate_messages_cpp) Directory structure is: catkin_new -build -devel -src -CMakeLists.txt -aa -msg -two_ints.msg -include -src src_aa.cpp -... -bb -CMakeLists.txt -src -src_bb.cpp -... Please help me out. I have tried various things but in vain. Also talker gets built even though it also includes aa/two_ints.h. Why so? And two_ints.h is present in devel/aa/ directory.

Viewing all articles
Browse latest Browse all 417

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>