Skip to content

Commit

Permalink
[Documentation] Update ros1 and ros2 model description
Browse files Browse the repository at this point in the history
  • Loading branch information
ipa-nhg committed Nov 14, 2023
1 parent 33f1719 commit b8f4b59
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 24 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ Publications:
- [(Only for tooling developers) From Source code in eclipse](docu/Installation.md#option-2-using-the-eclipse-installer---source-installation-ros-tooling-developers)
- VS Code plugin(tbd) - WIP [vscode-RosTooling](https://github.com/ipa320/vscode-RosTooling)

## Tutorials
## Tutorials v3

- Create component models:
- (Prerequisite) [Add communication objects](docu/NewCommunicationObjects.md)
- [Create a ROS model from your source code(static code analyzer)](docu/NewRosModel.md)
- [Create manually a new ROS component description](docu/RosModelDescription.md)
- [Generation of code from models](https://github.com/CoreSenseEU/rossdl#usage)
- [Create a ROS model from a deployed robot using our introspection at runtime tool](docu/IntrospectionNode.md)
- [Create new ROS component description](docu/RosModelDescription.md)
- [Generation of code from models](docu/CodeGeneration.md)
- [Create a ROS model from your source code(static code analyzer)](docu/NewRosModel.md))

- Combine components to form a ROS System
- [Create manually a new RosSystem description](docu/RosSystemModelDescription.md)
Expand Down
26 changes: 15 additions & 11 deletions docu/IntrospectionNode.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Create a ROS model from a deployed robot using our introspection at runtime tool
## Create a ROS model from a deployed robot using our introspection at runtime tool (for ROS 2 systems)

Please be sure that the tool is installed and your workspace setup, see the [installation guide](../README.md) for further details.

Expand All @@ -7,19 +7,23 @@ The tools documented here were conceived as a simple way to obtain models of sys
You can install the tools directly on your workspace using the following command:

```
mkdir -p my_catkin_ws/src
cd my_catkin_ws/src
catkin_init_workspace
rosinstall . https://raw.githubusercontent.com/ipa320/ros-model/master/docu/introspection.rosinstall
cd my_catkin_ws
catkin_make (or catkin build)
cd YourRos2WS/src
git clone git@github.com:ipa-nhg/ros2model.git
cd YourRos2WS
colcon build
```

To start the monitoring software the snapshot node has to be started on the same machine where the software to be analysed is running:
To ask the monitoring module to capture all the nodes running on the system, please use the following command:

```
source my_catkin_ws/devel/setup.bash
rosrun rosgraph_monitor rossystem_snapshot
ros2 model running_node -ga -d ~/PathToModelsFolderOutput
```

This script will generate automatically a new file (.rossystem) under the folder: 'rosgraph_monitor/results'.
The folder **PathToModelsFolderOutput** will contain all the model files.

For a single node, the following command can be called:
```
ros2 model running_node [-o Outputfile] <node-name>
```

For further information please check the [ros2model](https://github.com/ipa-cmh/ros2model) repository.
12 changes: 4 additions & 8 deletions docu/NewRosModel.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
:bangbang::bangbang::bangbang::bangbang: This tutorial is only working for previous versions of the RosTooling (v2)


## Create a ROS model from your code

Please be sure that the tool is installed and your workspace setup, see the [installation guide](../README.md) for further details.

To extract your model from ROS code ou have 3 options:
- [Use the available web interface to autogenerate models from code hosted on GitHub](#cloud)
To extract your model from ROS code ou have 2 options:
- [Call our docker container configuration for the extraction from a GitHub hosted repository (requires only the installation of Docker)](#docker-container)
- [Use a local build of your ROS package (requires the local installation of HAROS)](#local-ros-workspace)

### Cloud

Under the link [Model extractor](http://ros-model.seronet-project.de/) a web service to extract automatically models from existing open source ROS packages is available. The user only has to give as input the URL address of the repository (for example https://github.com/ipa320/cob_driver), the name of the package that contains the node to be analysed (for example cob_sick_s300) and the name of th node ( for example cob_sick_s300). The resulted model will be displayed on the right side of the window.

![alt text](images/cob_sick_s300_cloud.png)

### Docker container

Clone the repository [ros-model-extractors](https://github.com/ipa320/ros-model-extractors) and follow its [documentation instructions](https://github.com/ipa320/ros-model-extractors#ros-model-extractors).
Expand Down
192 changes: 191 additions & 1 deletion docu/RosModelDescription.md
Original file line number Diff line number Diff line change
@@ -1 +1,191 @@
## TBD
# HOW TO DESCRIBE ROS NODES USING THE LANGUAGE



Component models have two types of extensions, either .ros1 for ROS version 1 packages and .ros2 for ROS 2 packages. In both cases the language allows to describea pockage that contains ros nodes and their interfaces.
To create a new model, you can easily just create a new file with the correct extension. For example my_node.ros2.

## ROS (1)

In ros1 the grammar is as follows:
```
my_awesome_pkg: #Name of the package
**fromGitRepo: ** "http://github.com/MyAccount/RepoName:BranchName" # Optional, Git reopsitory path that contains the source code
**artifacts:**
awesome: # Name of the artifact (as it is named in the CMakeLists)
**node:** awesome_node # Name of the node
**publishers:** # (Optional) List of publishers
awesome_pub:
**type:** "std_msgs/msg/Bool"
**subscribers:** # (Optional) List of subscribers
awesome_sub:
**type:** "std_msgs/msg/Bool"
**serviceclients:** # (Optional) List of service clients
awesome_client:
**type:** "std_srvs/srv/Empty"
**serviceservers:** # (Optional) List of service servers
awesome_server:
**type:** "std_srvs/srv/Empty"
**actionclients:** # (Optional) List of action clients
awesome_action:
**type:** "control_msgs/action/JointTrajectory"
**actionservers:** # (Optional) List of action servers
awesome_action:
**type:** "control_msgs/action/JointTrajectory"
**parameters:** # (Optional) List of parameters
awesome_param:
**type:** String
**default:** "Hello"
```


The format is based the YAML file format. All the words marked in the template with '**' are keywords that compose the model, they can't be modified.


See the following model exmaple for the known teleop ROS package:

```
teleop:
artifacts:
teleop_twist_joy_node:
node: teleop_twist_joy_node
publishers:
cmd_vel:
type: "geometry_msgs/msg/Twist"
subscribers:
joy:
type:"sensor_msgs/msg/Joy"
```

## ROS 2

The ros2 grammar is as follows:
```
my_awesome_pkg:
**fromGitRepo: ** "http://github.com/MyAccount/RepoName:BranchName"
**artifacts:**
awesome:
**node:** awesome_node
**publishers:**
awesome_pub:
**type:** "std_msgs/msg/Bool"
**qos:**
**depth:** 10
**durability:** volatile
**history:** keep_all
**profile:** default_qos
**reliability:** best_effort
**subscribers:**
awesome_sub:
**type:** "std_msgs/msg/Bool"
**qos:**
**depth:** 10
**durability:** transient_local
**history:** keep_last
**profile:** sensor_qos
**reliability:** reliable
**serviceclients:**
awesome_client:
**type:** "std_srvs/srv/Empty"
**qos:**
**depth:** 10
**durability:** volatile
**history:** keep_all
**profile:** services_qos
**reliability:** best_effort
**serviceservers:**
awesome_server:
**type:** "std_srvs/srv/Empty"
**qos:**
**depth:** 10
**durability:** volatile
**history:** keep_all
**profile:** services_qos
**reliability:** best_effort
**actionclients:**
awesome_action:
**type:** "control_msgs/action/JointTrajectory"
**qos:**
**depth:** 10
**durability:** volatile
**history:** keep_all
**profile:** default_qos
**reliability:** best_effort
**actionservers:**
awesome_action:
**type:** "control_msgs/action/JointTrajectory"
**qos:**
**depth:** 10
**durability:** volatile
**history:** keep_all
**profile:** default_qos
**reliability:** best_effort
**parameters:**
awesome_param:
**type:** String
**default:** "Hello"
**qos:**
**depth:** 10
**durability:** volatile
**history:** keep_all
**profile:** parameter_qos
**reliability:** best_effort
```

The only remarkable difference with the ROS 1 model is that the quality of service can be defined for all the different interfaces. The quality of service atrributes are optional and they allow the following options:

- depth : it must be an integer.
- durability: volatile / transient_local
- history: keep_all / keep_last
- profile: default_qos / sensor_qos / services_qos/ parameter_qos
- reliability: best_effort / reliable


See the following example for the [arucos_ros](https://github.com/pal-robotics/aruco_ros) driver:

```
aruco_ros:
fromGitRepo: "https://github.com/pal-robotics/aruco_ros.git:humble-devel"
artifacts:
marker_publisher:
node: marker_publisher
subscribers:
image_raw:
type: "sensor_msgs/msg/Image"
publishers:
debug:
type: "sensor_msgs/msg/Image"
markers:
type: "aruco_msgs/msg/MarkerArray"
markers_list:
type: "std_msgs/msg/UInt32MultiArray"
result:
type: "sensor_msgs/msg/Image"
parameters:
camera_frame:
type: String
image_is_rectified:
type: Boolean
marker_size:
type: Double
reference_frame:
type: String
raw_image_topic:
type: String
use_camera_info:
type: Boolean
use_sim_time:
type: Boolean
camera_info_topic:
type: String
```

## Textual model editor

The textual editor contains checker embedded, for example:

![alt text](images/RosModelEmbededChecker.gif)

It incorporates also the auto-complete function. This is available by pressing **Ctrl** + the space bar:

![alt text](images/RosModelAutocomplete.gif)
Binary file added docu/images/RosModelAutocomplete.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docu/images/RosModelEmbededChecker.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b8f4b59

Please sign in to comment.