diff --git a/src/rosmod_actor/CMakeLists.txt b/src/rosmod_actor/CMakeLists.txt index 9be479b..ba1378c 100644 --- a/src/rosmod_actor/CMakeLists.txt +++ b/src/rosmod_actor/CMakeLists.txt @@ -13,80 +13,14 @@ else() message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() - -ADD_DEFINITIONS(-DNAMESPACE=rosmod) -find_package(catkin REQUIRED COMPONENTS std_msgs rosmod) -ADD_DEFINITIONS(-DUSE_ROSMOD) - -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -# -## Declare ROS messages, services and actions -# - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -# Generate messages in the 'msg' folder -#add_message_files( -# FILES -#) - -# Generate services in the 'srv' folder -#add_service_files( -# FILES -#) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -# Generate added messages and services with any dependencies listed here -#generate_messages( -# DEPENDENCIES -# std_msgs -#) +find_package(catkin REQUIRED COMPONENTS roscpp) # ## catkin specific configuration # -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need catkin_package( -# CATKIN_DEPENDS roscpp std_msgs - CATKIN_DEPENDS rosmod message_runtime -# DEPENDS system_lib + CATKIN_DEPENDS roscpp message_runtime + INCLUDE_DIRS include ) # @@ -101,22 +35,16 @@ include_directories( include ) -## Declare a cpp library -# add_library(node -# src/${PROJECT_NAME}/node.cpp -# ) - -## Declare a cpp executable -# add_executable(node_node src/node_node.cpp) - ## Add cmake target dependencies of the executable/library ## as an example, message headers may need to be generated before nodes # add_dependencies(node_node node_generate_messages_cpp) -## Specify libraries to link a library or executable target against -# target_link_libraries(node_node -# ${catkin_LIBRARIES} -# ) +# make rosmod_actor executable +add_executable(rosmod_actor + src/rosmod_actor/jsoncpp.cpp + src/rosmod_actor/component.cpp + src/rosmod_actor/main.cpp) +target_link_libraries(rosmod_actor dl ${catkin_LIBRARIES}) # ## Install @@ -125,13 +53,6 @@ include_directories( # all install targets should use catkin DESTINATION variables # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - ## Mark executables and/or libraries for installation # install(TARGETS node node_node # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} @@ -146,38 +67,12 @@ include_directories( # PATTERN ".svn" EXCLUDE # ) -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -# -## Testing -# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_node.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) - -# make rosmod_actor executable -add_executable(rosmod_actor - src/rosmod_actor/jsoncpp.cpp - src/rosmod_actor/component.cpp - src/rosmod_actor/main.cpp) -target_link_libraries(rosmod_actor dl ${catkin_LIBRARIES}) # install rosmod_actor executable install(TARGETS rosmod_actor ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}) -install(DIRECTORY include/ - DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION} + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) +install(DIRECTORY include/${PROJECT_NAME}/ + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} FILES_MATCHING PATTERN "*.hpp") diff --git a/src/rosmod_actor/include/rosmod_actor/component.hpp b/src/rosmod_actor/include/rosmod_actor/component.hpp index a3ac8dd..ad3d6b2 100644 --- a/src/rosmod_actor/include/rosmod_actor/component.hpp +++ b/src/rosmod_actor/include/rosmod_actor/component.hpp @@ -14,8 +14,8 @@ #include "rosmod_actor/logger.hpp" #include "rosmod_actor/json.hpp" -#include "rosmod/rosmod_ros.h" -#include "rosmod/rosmod_callback_queue.h" +#include "ros/ros.h" +#include "ros/callback_queue.h" /** * @brief Component class @@ -28,6 +28,11 @@ class Component { */ Component(Json::Value& _config); + /** + * @brief Component Destructor + */ + virtual ~Component(); + /** * @brief Component startup function * @@ -41,22 +46,17 @@ class Component { * @param[in] event a oneshot timer event * @see startUp() */ - virtual void init_timer_operation(const rosmod::TimerEvent& event); + virtual void init_timer_operation(const ros::TimerEvent& event) = 0; /** * @brief Component Message Queue handler */ void process_queue(); - /** - * @brief Component Destructor - */ - virtual ~Component(); - protected: Json::Value config; /*!< Component Configuration */ - rosmod::Timer init_timer; /*!< Initialization timer */ - rosmod::CallbackQueue comp_queue; /*!< Component Message Queue */ + ros::Timer init_timer; /*!< Initialization timer */ + ros::CallbackQueue comp_queue; /*!< Component Message Queue */ std::unique_ptr logger; /*!< Component logger object */ std::string workingDir; /*!< Working directory of the process */ }; diff --git a/src/rosmod_actor/package.xml b/src/rosmod_actor/package.xml index bc63ab3..fc6de58 100644 --- a/src/rosmod_actor/package.xml +++ b/src/rosmod_actor/package.xml @@ -1,5 +1,5 @@ - + rosmod_actor 0.0.0 The rosmod actor package @@ -33,22 +33,13 @@ message_generation - - - - message_runtime - - catkin - rosmod_jsoncpp - rosmod_component - rosmod - std_msgs - rosmod_jsoncpp - rosmod_component - rosmod - std_msgs - + rosmod_jsoncpp + rosmod_component + rosmod + roscpp + std_msgs + message_runtime diff --git a/src/rosmod_actor/src/rosmod_actor/component.cpp b/src/rosmod_actor/src/rosmod_actor/component.cpp index 62424c4..a7f49ac 100644 --- a/src/rosmod_actor/src/rosmod_actor/component.cpp +++ b/src/rosmod_actor/src/rosmod_actor/component.cpp @@ -29,12 +29,9 @@ Component::~Component() { init_timer.stop(); } -// Initialization -void Component::init_timer_operation(const rosmod::TimerEvent& event) {} - // Component Operation Queue Handler void Component::process_queue() { - rosmod::NodeHandle nh; + ros::NodeHandle nh; while (nh.ok()) this->comp_queue.callAvailable(ros::WallDuration(0.01)); } diff --git a/src/rosmod_actor/src/rosmod_actor/main.cpp b/src/rosmod_actor/src/rosmod_actor/main.cpp index 7dc3dfe..536fa9d 100644 --- a/src/rosmod_actor/src/rosmod_actor/main.cpp +++ b/src/rosmod_actor/src/rosmod_actor/main.cpp @@ -18,7 +18,7 @@ #include #include -#include "rosmod/rosmod_ros.h" +#include "ros/ros.h" #include #include @@ -119,10 +119,10 @@ int main(int argc, char **argv) ROS_INFO_STREAM("Thread priority is " << params.sched_priority << std::endl); nodeName = root["Name"].asString(); - rosmod::init(argc, argv, nodeName.c_str(), ros::init_options::NoSigintHandler); + ros::init(argc, argv, nodeName.c_str(), ros::init_options::NoSigintHandler); signal(SIGINT, rosmod_actor_SigInt_handler); // Create Node Handle - rosmod::NodeHandle n; + ros::NodeHandle n; ROS_INFO_STREAM(nodeName << " thread id = " << boost::this_thread::get_id());