Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ros2 #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
3 changes: 0 additions & 3 deletions README

This file was deleted.

41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
14 changes: 9 additions & 5 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<package>
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rtt_dot_service</name>
<version>0.0.1</version>
<description >
Expand Down Expand Up @@ -56,8 +58,10 @@
<license>LGPLv2.1 / BSD</license>
<url>http://ros.org/wiki/rtt_dot_service</url>

<buildtool_depend>catkin</buildtool_depend>
<build_depend>rtt</build_depend>
<run_depend>rtt</run_depend>

<buildtool_depend>ament_cmakec</buildtool_depend>
<depend>rclcpp</depend>
<depend>rtt_ros2</depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
2 changes: 1 addition & 1 deletion src/rtt_dot_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<internal::ConnectionManager::ChannelDescriptor> chns = sv->getPort(comp_ports[j])->getManager()->getChannels();
std::list<internal::ConnectionManager::ChannelDescriptor> chns = sv->getPort(comp_ports[j])->getManager()->getConnections();
std::list<internal::ConnectionManager::ChannelDescriptor>::iterator k;
if(chns.empty()){
log(Debug) << "Looks like we have an empty channel!" << endlog();
Expand Down