Skip to content
Snippets Groups Projects
Commit 0a8f9806 authored by Thomas Moulard's avatar Thomas Moulard
Browse files

Share node handle between modules.

parent 2007fde9
No related branches found
No related tags found
No related merge requests found
......@@ -3,71 +3,59 @@ include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
include(FindPkgConfig)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)
set(ROS_BUILD_TYPE RelWithDebInfo)
rosbuild_init()
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()
rosbuild_add_boost_directories()
#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
pkg_check_modules(JRL_MAL REQUIRED jrl-mal)
pkg_check_modules(DYNAMIC_GRAPH REQUIRED dynamic-graph)
pkg_check_modules(SOT_CORE REQUIRED sot-core)
rosbuild_add_library(ros_import
src/sot_to_ros.cpp
src/ros_import.cpp src/ros_import.hh src/converter.hh src/sot_to_ros.hh)
rosbuild_add_library(ros_bridge
src/converter.hh
src/ros_init.hh src/ros_init.cpp
src/sot_to_ros.hh src/sot_to_ros.cpp
)
rosbuild_add_library(ros_import src/ros_import.cpp src/ros_import.hh)
rosbuild_add_compile_flags(ros_import ${JRL_MAL_CFLAGS} ${DYNAMIC_GRAPH_CFLAGS}
${SOT_CORE_CFLAGS})
rosbuild_add_link_flags(ros_import ${JRL_MAL_LDFLAGS} ${DYNAMIC_GRAPH_LDFLAGS}
${SOT_CORE_LDFLAGS})
target_link_libraries(ros_import ros_bridge)
target_link_libraries(ros_import
${JRL_MAL_LIBRARIES} ${DYNAMIC_GRAPH_LIBRARIES} ${SOT_CORE_LIBRARIES})
rosbuild_add_library(ros_export
src/sot_to_ros.cpp
src/ros_export.cpp src/ros_export.hh src/converter.hh src/sot_to_ros.hh)
rosbuild_add_library(ros_export src/ros_export.cpp src/ros_export.hh)
rosbuild_add_compile_flags(ros_export ${JRL_MAL_CFLAGS} ${DYNAMIC_GRAPH_CFLAGS}
${SOT_CORE_CFLAGS})
rosbuild_add_link_flags(ros_export ${JRL_MAL_LDFLAGS} ${DYNAMIC_GRAPH_LDFLAGS}
${SOT_CORE_LDFLAGS})
target_link_libraries(ros_export ros_bridge)
target_link_libraries(ros_export
${JRL_MAL_LIBRARIES} ${DYNAMIC_GRAPH_LIBRARIES} ${SOT_CORE_LIBRARIES})
rosbuild_add_library(ros_joint_state
src/ros_joint_state.cpp src/ros_joint_state.hh src/converter.hh src/sot_to_ros.hh)
rosbuild_add_compile_flags(ros_joint_state ${JRL_MAL_CFLAGS} ${DYNAMIC_GRAPH_CFLAGS}
src/ros_joint_state.cpp src/ros_joint_state)
rosbuild_add_compile_flags(ros_joint_state
${JRL_MAL_CFLAGS} ${DYNAMIC_GRAPH_CFLAGS}
${SOT_CORE_CFLAGS})
rosbuild_add_link_flags(ros_joint_state ${JRL_MAL_LDFLAGS} ${DYNAMIC_GRAPH_LDFLAGS}
${SOT_CORE_LDFLAGS})
rosbuild_add_link_flags(ros_joint_state ${JRL_MAL_LDFLAGS}
${DYNAMIC_GRAPH_LDFLAGS} ${SOT_CORE_LDFLAGS})
target_link_libraries(ros_joint_state ros_bridge)
target_link_libraries(ros_joint_state
${JRL_MAL_LIBRARIES} ${DYNAMIC_GRAPH_LIBRARIES} ${SOT_CORE_LIBRARIES})
INSTALL(TARGETS ros_bridge DESTINATION lib)
INSTALL(TARGETS ros_import DESTINATION lib)
INSTALL(TARGETS ros_export DESTINATION lib)
INSTALL(TARGETS ros_joint_state DESTINATION lib)
......
......@@ -9,6 +9,7 @@
#include <dynamic-graph/factory.h>
#include "ros_init.hh"
#include "ros_export.hh"
namespace dynamicgraph
......@@ -112,17 +113,6 @@ namespace dynamicgraph
} // end of errorEstimator.
} // end of namespace command.
const char* rosInit()
{
int argc = 1;
char* arg0 = strdup("ros_export");
char* argv[] = {arg0, 0};
ros::init(argc, argv, "ros_export");
free (arg0);
return "dynamic_graph";
}
RosExport::RosExport (const std::string& n)
: dynamicgraph::Entity(n),
nh_ (rosInit ()),
......
......@@ -13,6 +13,7 @@
#include <dynamic-graph/factory.h>
#include <dynamic-graph/command.h>
#include "ros_init.hh"
#include "ros_import.hh"
namespace dynamicgraph
......@@ -115,17 +116,6 @@ namespace dynamicgraph
} // end of errorEstimator.
} // end of namespace command.
const char* rosInit()
{
int argc = 1;
char* arg0 = strdup("ros_import");
char* argv[] = {arg0, 0};
ros::init(argc, argv, "ros_import");
free (arg0);
return "dynamic_graph";
}
RosImport::RosImport (const std::string& n)
: dynamicgraph::Entity(n),
nh_ (rosInit ()),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment