My file structure is as follows:
catkin_workspace/src/
package/
subpackage_1/src/subpackage_1.cpp
subpackage_2/src/subpackage_2.cpp
package (Metapackage)
I define a class in each of these .cpp files, and each one contains an instance of the same base class. Where should I save this base class to conform with the ROS C++ Style Guide? And what would I need to add to each subpackage_#'s CMakeLists.txt? Thanks.
EDIT: It's working. I didn't modify the structure of the packages at all. Here are the contents of catkin_workspace/src/package/subpackage_3/CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(subpackage_3)
SET(CMAKE_BUILD_TYPE RELEASE)
find_package(catkin REQUIRED COMPONENTS
roscpp)
find_package( PCL REQUIRED )
catkin_package(CATKIN_DEPENDS roscpp
INCLUDE_DIRS include
LIBRARIES subpackage_3
)
include_directories(
include
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)
set(PKG3_COM_LIB_SOURCES
src/subpackage_3.cpp)
add_library (subpackage_3 ${PKG3_COM_LIB_SOURCES})
The only modification I needed to make to subpackage_<1, 2>/CMakeLists.txt was to add find_package(subpackage_3). I also added < depend>subpackage_3< /depend> to subpackage_<1, 2>/package.xml (without the spaces).
Originally posted by mc123 on ROS Answers with karma: 13 on 2016-05-26
Post score: 0