From bf8d69e219a84abf268cd9c3dbf2a508ae438a6d Mon Sep 17 00:00:00 2001 From: Felix Mauch Date: Tue, 9 Apr 2019 18:24:57 +0200 Subject: [PATCH] Added test executable --- CMakeLists.txt | 6 +++++ src/producer.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/producer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ad9fe17..02e9c4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,12 @@ add_library(ur_rtde_driver target_link_libraries(ur_rtde_driver ${catkin_LIBRARIES}) add_dependencies(ur_rtde_driver ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) +add_executable(producer + src/producer.cpp +) +target_link_libraries(producer ${catkin_LIBRARIES} ur_rtde_driver) +add_dependencies(producer ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + install(TARGETS ur_rtde_driver ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} diff --git a/src/producer.cpp b/src/producer.cpp new file mode 100644 index 0000000..abd689c --- /dev/null +++ b/src/producer.cpp @@ -0,0 +1,57 @@ +// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- + +// -- BEGIN LICENSE BLOCK ---------------------------------------------- +// -- END LICENSE BLOCK ------------------------------------------------ + +//---------------------------------------------------------------------- +/*!\file + * + * \author Felix Mauch mauch@fzi.de + * \date 2018-12-11 + * + */ +//---------------------------------------------------------------------- +#include +#include +#include +#include +#include + +#include +#include + +static const int UR_PRIMARY_PORT = 30001; +static const int UR_SECONDARY_PORT = 30002; +static const int UR_RT_PORT = 30003; + +using namespace ur_driver; +using namespace primary_interface; + +int main(int argc, char* argv[]) +{ + std::string ROBOT_IP = "192.168.56.101"; + // std::string ROBOT_IP = "192.168.0.104"; + comm::URStream stream(ROBOT_IP, UR_PRIMARY_PORT); + + if (ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug)) + { + ros::console::notifyLoggerLevelsChanged(); + } + + primary_interface::PrimaryParser parser; + comm::URProducer prod(stream, parser); + comm::ShellConsumer consumer; + + comm::INotifier notifier; + + comm::Pipeline pipeline(prod, consumer, "Pipeline", notifier); + LOG_INFO("Running now"); + pipeline.run(); + while (true) + { + sleep(1); + // LOG_INFO("Still running"); + } + + return 0; +}