From adea585fd77e0fb1c7a6cbd3f2f2877df564e287 Mon Sep 17 00:00:00 2001 From: Gianni Borghesan Date: Wed, 28 Apr 2021 12:50:23 +0200 Subject: [PATCH 1/3] ros2 porting --- CMakeLists.txt | 20 ++++++-------------- README | 3 --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ package.xml | 14 +++++++++----- src/rtt_dot_service.cpp | 2 +- 5 files changed, 57 insertions(+), 23 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/CMakeLists.txt b/CMakeLists.txt index e5b8715..9c207d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,15 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.3) project(rtt_dot_service) - +find_package(ament_cmake REQUIRED) set (ROS_ROOT $ENV{ROS_ROOT} ) -if (ROS_ROOT) - find_package(catkin REQUIRED) - include_directories(${catkin_INCLUDE_DIRS}) - include_directories(${USE_OROCOS_INCLUDE_DIRS}) - set( RTT_HINTS HINTS ${rtt_PACKAGE_PATH}/install ) -endif() - -set(CMAKE_BUILD_TYPE MinSizeRel) -set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) -set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(rtt_ros2 REQUIRED) -find_package(OROCOS-RTT REQUIRED ${RTT_HINTS}) -include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake) +ament_package() orocos_service(rtt_dot_service src/rtt_dot_service.cpp) orocos_generate_package( diff --git a/README b/README deleted file mode 100644 index fa36af8..0000000 --- a/README +++ /dev/null @@ -1,3 +0,0 @@ -OROCOS dot service - -read the manifest.xml file for usage instructions diff --git a/README.md b/README.md new file mode 100644 index 0000000..c40457b --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# OROCOS dot service + +_This branch is meant to be used in the contex of the rtt_ros2 integration._ + +The rtt_dot_service is an RTT service which generates a file in the [DOT language format]("http://www.graphviz.org/doc/info/lang.html") containing an overview of your current deployment configuration. + It can be visualised with any DOT visualizer to give you an overview of: + + - all components currently deployed, together with their status information. + - all component ports (connected and unconnected), and how they are connected. + +The service takes into account all peer components of the component in which you load the service. To get an overview of your complete deployment configuration, load this service in the Deployer component. +You can trigger the execution: manually, using the `generate()` function, but it will execute automatically with every component update as well (don't forget to attach an activity to your Deployer component!) + +To use it, load the service in your Deployer component, e.g. in your .ops script, add: +``` + import("rtt_ros2") + ros.import("rtt_dot_service") + loadService("Deployer","dot") +``` + + or equivalently in a .lua script: + + ``` + rtt.provides("ros"):import("rtt_dot_service") + depl:loadService("Deployer","dot") +``` + +The service has a property, `dot_file`, which you can adjust to the file you like to be generated. The way components, connections and channels can be plotted can be tuned using the comp_args, conn_args and chan_args properties. Visualisation of the dot file is possible, e.g. with xdot: +``` + xdot orograph.dot +``` + +Colors are used to display the component's current state: + - Init - **white** + - PreOperational - **orange** + - FatalError, Exception, RunTimeError - **red** + - Stopped - **lightblue** + - Running - **green** + + +More information about the DOT language is available at http://www.graphviz.org/doc/info/lang.html and http://www.graphviz.org/Documentation/dotguide.pdf diff --git a/package.xml b/package.xml index 1ba5fbf..65d9505 100644 --- a/package.xml +++ b/package.xml @@ -1,4 +1,6 @@ - + + + rtt_dot_service 0.0.1 @@ -56,8 +58,10 @@ LGPLv2.1 / BSD http://ros.org/wiki/rtt_dot_service - catkin - rtt - rtt - + ament_cmakec + rclcpp + rtt_ros2 + + ament_cmake + diff --git a/src/rtt_dot_service.cpp b/src/rtt_dot_service.cpp index beb91dc..4f0a10d 100644 --- a/src/rtt_dot_service.cpp +++ b/src/rtt_dot_service.cpp @@ -73,7 +73,7 @@ void Dot::scanService(std::string path, Service::shared_ptr sv) // Loop over all ports for(unsigned int j = 0; j < comp_ports.size(); j++){ log(Debug) << "Port: " << comp_ports[j] << endlog(); - std::list chns = sv->getPort(comp_ports[j])->getManager()->getChannels(); + std::list chns = sv->getPort(comp_ports[j])->getManager()->getConnections(); std::list::iterator k; if(chns.empty()){ log(Debug) << "Looks like we have an empty channel!" << endlog(); From a97be6a7be06280c91a71978f034007a2683f7a8 Mon Sep 17 00:00:00 2001 From: Gianni Date: Wed, 28 Apr 2021 12:57:59 +0200 Subject: [PATCH 2/3] Update README.md --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c40457b..0ed7eaa 100644 --- a/README.md +++ b/README.md @@ -13,21 +13,20 @@ You can trigger the execution: manually, using the `generate()` function, but it To use it, load the service in your Deployer component, e.g. in your .ops script, add: ``` - import("rtt_ros2") - ros.import("rtt_dot_service") - loadService("Deployer","dot") +import("rtt_ros2") +ros.import("rtt_dot_service") +loadService("Deployer","dot") ``` +or equivalently in a .lua script: - or equivalently in a .lua script: - - ``` - rtt.provides("ros"):import("rtt_dot_service") - depl:loadService("Deployer","dot") +``` +rtt.provides("ros"):import("rtt_dot_service") +depl:loadService("Deployer","dot") ``` The service has a property, `dot_file`, which you can adjust to the file you like to be generated. The way components, connections and channels can be plotted can be tuned using the comp_args, conn_args and chan_args properties. Visualisation of the dot file is possible, e.g. with xdot: ``` - xdot orograph.dot +xdot orograph.dot ``` Colors are used to display the component's current state: From 53c29e826b4979c79dcaf1e0ea09fb5a0b605cee Mon Sep 17 00:00:00 2001 From: Gianni Date: Thu, 24 Jun 2021 15:17:32 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0ed7eaa..7e9f8c1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OROCOS dot service -_This branch is meant to be used in the contex of the rtt_ros2 integration._ +_This branch is meant to be used in the context of the rtt_ros2 integration._ The rtt_dot_service is an RTT service which generates a file in the [DOT language format]("http://www.graphviz.org/doc/info/lang.html") containing an overview of your current deployment configuration. It can be visualised with any DOT visualizer to give you an overview of: @@ -30,11 +30,12 @@ xdot orograph.dot ``` Colors are used to display the component's current state: - - Init - **white** - - PreOperational - **orange** - - FatalError, Exception, RunTimeError - **red** - - Stopped - **lightblue** - - Running - **green** + + - Init - **white** + - PreOperational - **orange** + - FatalError, Exception, RunTimeError - **red** + - Stopped - **lightblue** + - Running - **green** More information about the DOT language is available at http://www.graphviz.org/doc/info/lang.html and http://www.graphviz.org/Documentation/dotguide.pdf