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..7e9f8c1 --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# OROCOS dot service + +_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: + + - 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();