diff --git a/CMakeLists.txt b/CMakeLists.txt index ebd31cc61ffa879c94ce2fdc6eaaf600a56943c7..dfb477604a3919687abde4cd76fd6618c185bacd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,10 @@ cmake_minimum_required(VERSION 3.10) project(wolf_ros_node) -## Compile as C++11, supported in ROS Kinetic and newer -add_compile_options(-std=c++14) +## Compile as C++14 +add_compile_options(-std=c++14) +# -fPIC and -rdynamic ensure unique singleton instance across shared libraries (for factories) see: https://stackoverflow.com/a/8626922 +SET(CMAKE_CXX_FLAGS "-fPIC -rdynamic") find_package(catkin REQUIRED COMPONENTS roslib @@ -38,40 +40,31 @@ include_directories( ${catkin_INCLUDE_DIRS} ) - add_executable(${PROJECT_NAME} src/node.cpp) add_library(subscriber_${PROJECT_NAME} - src/subscriber_diffdrive.cpp - src/subscriber_odom2d.cpp) + src/subscriber_diffdrive.cpp + src/subscriber_odom2d.cpp) + add_library(publisher_${PROJECT_NAME} - src/publisher_graph.cpp - src/publisher_pose.cpp - src/publisher_trajectory.cpp - src/publisher_state_block.cpp - src/publisher_tf.cpp) + src/publisher_graph.cpp + src/publisher_pose.cpp + src/publisher_trajectory.cpp + src/publisher_state_block.cpp + src/publisher_tf.cpp) ## Specify libraries to link a library or executable target against target_link_libraries(subscriber_${PROJECT_NAME} ${catkin_LIBRARIES} - ceres wolfcore - yaml-cpp - dl ) target_link_libraries(publisher_${PROJECT_NAME} ${catkin_LIBRARIES} - ceres wolfcore - yaml-cpp - dl ) target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} - ceres wolfcore - yaml-cpp - dl ) \ No newline at end of file diff --git a/include/node.h b/include/node.h index 8ba4ef10b6cdf02f64d36710c0bd328af54189f9..8324843dbbc865276bb527563164660e32e5b19a 100644 --- a/include/node.h +++ b/include/node.h @@ -61,7 +61,6 @@ #include "publisher.h" using namespace wolf; -using namespace std; class WolfRosNode { diff --git a/src/node.cpp b/src/node.cpp index 8e4354348f9d7b595b8481662d4b336dc312a55c..910cfdacd7ce47c71426bc8553d4dbf32cb9feea 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -84,12 +84,7 @@ WolfRosNode::WolfRosNode() WOLF_TRACE("Loading publisher " + type + " via " + lib_publisher); auto l = std::make_shared<LoaderRaw>(lib_publisher); - - FactoryPublisher::printCallbacks(); - FactoryPublisher::printAddress(); l->load(); - FactoryPublisher::printCallbacks(); - FactoryPublisher::printAddress(); //loaders_.push_back(l); WOLF_INFO("Pub: ", type, " name: ", name);