Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #35 from iml130/development
Browse files Browse the repository at this point in the history
Firos Version v.0.3.0
  • Loading branch information
Luxxii committed Nov 20, 2019
2 parents 683bb93 + b9e722e commit 92c86d1
Show file tree
Hide file tree
Showing 27 changed files with 377 additions and 858 deletions.
11 changes: 0 additions & 11 deletions config/robotdescriptions.json

This file was deleted.

34 changes: 0 additions & 34 deletions config/robots.json

This file was deleted.

9 changes: 9 additions & 0 deletions config/topics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"/robot2/cmd_vel_mux/input/teleop": ["geometry_msgs/Twist", "publisher" ],
"/robot2/cmd_serial": ["std_msgs/String", "publisher" ],
"/robot2/move_base/goal": ["move_base_msgs/MoveBaseActionGoal", "publisher" ],
"/robot2/move_base/result": ["move_base_msgs/MoveBaseActionResult", "subscriber" ],

"/end_end_test/p1": ["std_msgs/String", "publisher" ],
"/end_end_test/s1": ["std_msgs/String", "subscriber" ]
}
17 changes: 5 additions & 12 deletions config/whitelist.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
{
"turtle\\w+": {
"publisher": ["cmd_vel"],
"subscriber": ["pose"]
},
"robot\\w+": {
"publisher": ["cmd_vel.*teleop", ".*move_base/goal", ".*move_base/cancel"],
"subscriber": [".*move_base/result"]
},
"\\w+bot\\w*": {
"publisher": [".*cmd_vel.*", ".*move_base/goal.*"],
"subscriber": []
}
"publisher" : ["/turtle\\w+/cmd_vel",
"/robot\\w+/cmd_vel.*"],

"subscriber": ["/turtle\\w+/pose",
".*move_base/result"]
}
12 changes: 1 addition & 11 deletions doc/deprecated.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# Deprecated Features

## REST-API `whitelist` on FIROS

FIROS currently has a REST-API, where someone can manipulate the whitelist of an FIROS-instance (see:
[API](user/api.md)). We are currently not planning to expand this functionality, because the `whitelist.json` is
definitely known prior and is overwritten by the configuration in `robots.json`.

Specifically, the following methods are provided as is and are not maintained:

- `FIROS:/whitelist/write`
- `FIROS:/whitelist/remove`
- `FIROS:/whitelist/restore`
Currently no deprecated Features in Firos.
153 changes: 37 additions & 116 deletions doc/install/configuration-files.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Configuration-Files

FIROS needs 3 different configuration files inside the Configuration-Folder. An example Configuration-Folder can be
found in the `config`-Folder at the base of this repository. It needs to contain the files `config.json`, `robots.json`
and `whitelist.json` (optionally: `robotdescriptions.json`).
FIROS needs 2 different configuration files inside the Configuration-Folder. An example Configuration-Folder can be
found in the `config`-Folder at the base of this repository. It needs to contain the files `config.json` and
`topics.json` (optionally: `whitelist.json`).

In the follwing each of the configuration files are explained in detail:

Expand Down Expand Up @@ -35,6 +35,10 @@ configuration as shown in the following example:
"subscription_refresh_delay": 0.9
}
},
"endpoint": {
"address": "10.16.55.3",
"port": 1234
},
"log_level": "INFO"
}
}
Expand All @@ -44,17 +48,16 @@ We also added here the contextbroker configuration, since we want to publish and

Here is the list of all currently possibilities for a configuration:

| Attribute | Value | Required |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: |
| "endpoint" | An object, which can have an `address` and a `port`. If the Address differs, where FIROS should get the notifications from, then at this here. | |
| "log_level" | Can be either `"INFO"` (Default), `"DEBUG"`, `"WARNING"`, `"ERROR"` or `"CRITICAL"`. | |
| "node_name" | This sets the ROS-Node-Name for this FIROS instance. The default is `"firos"`. | |
| "ros_subscriber_queue" | The queue-size of the `rospy.Publisher`. See more [here](http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers). Default is `10` | |
| "context_type" | This sets the context type of an entity (the `type`-value of the base-entity). Default is `"ROBOT"` but can be changed if necessary | |
| "rosbridge_port" | Changes the ROS-Port, where to listen. Default is `9090` | |
| "server" | An object `{}` which contains the attribute `"port"` | |
| "contextbroker" | An object `{}` which contains the attributes `"adress"`, `"port"` and `"subscriptions"` | x |
| "pub_frequency" | An Integer of Milliseconds. This limits the number of publishes e.g. to the Context-Broker. This blocks the next publish for `pub_frequency` milliseconds. | |
| Attribute | Value | Required |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----------------------------------------------------: |
| "endpoint" | An object, which can have an `address` and a `port`. If the Address differs, where FIROS should get the notifications from, then add this here. | |
| "log_level" | Can be either `"INFO"` (Default), `"DEBUG"`, `"WARNING"`, `"ERROR"` or `"CRITICAL"`. | |
| "node_name" | This sets the ROS-Node-Name for this FIROS instance. The default is `"firos"`. | |
| "ros_subscriber_queue" | The queue-size of the `rospy.Publisher`. See more [here](http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers). Default is `10` | |
| "rosbridge_port" | Changes the ROS-Port, where to listen. Default is `9090` | |
| "server" | An object `{}` which contains the attribute `"port"` | |
| "contextbroker" | An object `{}` which contains the attributes `"adress"`, `"port"` and `"subscriptions"` | (`x`, firos should at least know where to publish data) |
| "pub_frequency" | An Integer of Milliseconds. This limits the number of publishes e.g. to the Context-Broker. This blocks the next publish for `pub_frequency` milliseconds. | |

### `"server"`-Configuration

Expand Down Expand Up @@ -85,22 +88,12 @@ Information about the `cmd_vel` (`Twist`-Information), its data is published int

```json
{
"turtle1": {
"topics": {
"cmd_vel": {
"msg": "geometry_msgs.msg.Twist",
"type": "publisher"
},
"pose": {
"msg": "turtlesim.msg.Pose",
"type": "subscriber"
}
}
}
"/turtle1/cmd_vel": ["geometry_msgs/Twist", "publisher"],
"/turtle1/pose": ["turtlesim/Pose", "subscriber"]
}
```

This json in particular listens to the rostopic `/turtle1/pose` with the message type `"turtlesim.msg.Pose"` (the
This json in particular listens to the rostopic `/turtle1/pose` with the message type `"turtlesim/Pose"` (the
corresponding python message from `turtlesim/Pose`) and sends all retreived data to the specified server in the
Non-ROS-World. It publishes data into `/turtle1/cmd_vel` after receiving a notifcation of the server from the
Non-ROS-World from type `geometry_msgs/Twist`.
Expand All @@ -115,58 +108,36 @@ from the green arrows, which happens automatically.
You do not have to specify `publisher` and `subscriber` of all available topics or at all for a robot. Only specify the
needed ones, which need to be displayed from/or need to obtain information on the Non-ROS-World

```json
{
"ROBOT_ID": {
"topics": {
"TOPIC_1": {
"msg": "PYTHON_REPRESENTATION_MESSAGE_TYPE",
"type": "publisher"
},
"TOPIC_2": {
"msg": "PYTHON_REPRESENTATION_MESSAGE_TYPE",
"type": "subscriber"
}
}
},
"ROBOT_ID_2": {
"topics": {
"TOPIC_1": {
"msg": "PYTHON_REPRESENTATION_MESSAGE_TYPE",
"type": "subscriber"
}
}
}
}
```

The Information given by the `robots.json` is appended/replaced to the `whitelist.json` which is described below.

---

## `whitelist.json`

As the name suggests, the `whitelist.json` functions as a whitelist to let FIROS know which messages it should keep
track of. Given an environment where already ROS-Applications are running, FIROS will automatically subscribe to all
available topics if no `whitelist.json` is given. In a small ROS-World with few ROS-Applications, this can be desirable.
track of. Given an environment where already ROS-Applications are running, FIROS will not automatically subscribe to all
available topics if no `whitelist.json` is given. In a small ROS-World with few ROS-Applications, it can be desirable to
subscribe to all topics. This can be achieved via:

```json
{
"publisher": [],
"subscriber": [".*"]
}
```

But this can cause problems in a ROS-World, where many ROS-Applications are running. To let FIROS only subscribe to
specific topics, the following configuration can be used:

```json
{
"turtle2": {
"publisher": ["cmd_vel"],
"subscriber": ["pose"]
}
"publisher": [".*/pose"],
"subscriber": [".*/cmd_vel"]
}
```

This only allows FIROS to subscribe/publish to `"/turtle2/pose"` and `"turtle2/cmd_vel"` plus the extra-configuration
given in `robots.json` which in the above example would also be `"/turtle1/pose"` and `"turtle1/cmd_vel"`.

**Note**, that an empty configuration of `whitelist.json` (`-> {}`) will also behave as an
non-existent-configuration-file. Usually for normal usecases, the `whitelist.json` contains the same information as the
`robots.json` and should be sufficient.
This only allows FIROS to subscribe/publish to specific topics plus the extra-configuration given in `robots.json` which
in the above example would also be `"/turtle1/pose"` and `"/turtle1/cmd_vel"`.

**Note:** The FIROS only captures running ROS-Applications at the startup. All applications started after FIROS will not
be recognized.
Expand All @@ -175,55 +146,5 @@ be recognized.
Message-Type. However, the "Message-Implementation" still needs to be present locally at the FIROS-Instance (via the
`msgs`-Folder, or compiled by catkin)

The `whitelist.json` also supports Regular Expressions (Regex), so you can refer to more Robots and Topics in just a few
lines.

Here we address all `turtle[a-zA-Z0-9]+` and `robot[a-zA-Z0-9]+` Robots with their topics:

```json
{
"turtle\\w+": {
"publisher": ["cmd_vel"],
"subscriber": ["pose"]
},
"robot\\w+": {
"publisher": ["cmd_vel.*teleop", ".*move_base/goal", ".*move_base/cancel"],
"subscriber": [".*move_base/result"]
}
}
```

---

## `robotdescriptions.json`

This configuration is optional and just appends additional information into the Non-ROS-World if even implemented.

E. g. The Context-Broker puts them under the `"descriptions"`-attribute. Those can be Links/Strings or maybe some
'static' values you need to have present for a robot/topic.

It can look like this:

```json
{
"turtle1": {
"descriptions": [
"http://wiki.ros.org/ROS/Tutorials/UsingRxconsoleRoslaunch",
"http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes"
]
}
}
```

Or like this:

```json
{
"turtle1": {
"descriptions": {
"MySanatiyValue": 42,
"SomeReferenceLink": "http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes"
}
}
}
```
The `whitelist.json` also supports more complex Regular Expressions (Regex), so you can refer to more topics in just a
few lines.
6 changes: 3 additions & 3 deletions doc/install/install.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Installion From Scratch With ROS, Orion Context-Broker and catkin
# Installation From Scratch With ROS, Orion Context-Broker and catkin

To Install Firos you first need to follow this [Installaion Instuctions](http://wiki.ros.org/ROS/Installation). ROS is
needed for FIROS, since it imports `ROS-messages` and uses other specific `ROS-Executables` like `rospy` or `rostopic`.
Expand Down Expand Up @@ -126,7 +126,7 @@ Beginning from the base of this repository, FIROS can be built via docker using:
> docker build -f ./docker/Dockerfile --tag firos:localbuild .
This will create an image with a pre-configured `config.json` which requires the Orion-ContextBroker. Before running
this image, you need to specify a `robots.json`. Information on how to create the configuration-files can be found in
this image, you need to specify a `topics.json`. Information on how to create the configuration-files can be found in
[Configuration-Files](configuration-files.md) or in the [Turtlesim-Example](turtlesim-example.md). An
example-pre-configured configuration for docker can be found in `firos/docker/docker-config`

Expand All @@ -147,7 +147,7 @@ docker run -it --rm --net finet --name orion --link mongodb -p 1026:1026 fiware/
docker run -it --net finet --name firos \
-p 10100:10100 \
--env ROS_MASTER_URI=http://rosmaster:11311 \
-v CONFIG_FILE_ROBOTS:/catkin_ws/src/firos/config/robots.json \
-v CONFIG_FILE_TOPICS:/catkin_ws/src/firos/config/topics.json \
-v CONFIG_FILE_WHITELIST:/catkin_ws/src/firos/config/whitelist.json \
firos:localbuild
```
Expand Down
8 changes: 4 additions & 4 deletions doc/install/standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FIROS now allows to implement custom standards to do multiple publications of data on multiple platforms with only one
instance. In order to write a new standard, where the ROS-Messages are transformed in your standard and vice-versa, you
need to think about following:
need to think about the following:

- Think of a name for your standard. In this example we choose `testbroker`
- Does your standard need any Configuration to work porperly? A server might need an `address` or `port`. Or if you
Expand Down Expand Up @@ -65,7 +65,7 @@ class SomeExamplePublisher(Publisher):
def __init__(self):
pass

def publish(self, robotID, topic, rawMsg, msgDefinitions):
def publish(self, topic, rawMsg, msgDefinitions):
pass

def unpublish(self):
Expand Down Expand Up @@ -96,7 +96,7 @@ class SomeExampleSubscriber(Subscriber):
def __init__(self):
pass

def subscribe(self, robotID, topicList, msgDefinitions):
def subscribe(self, topicList, msgDefinitions):
pass

def unsubscribe(self):
Expand All @@ -117,7 +117,7 @@ The received Messages need to be converted into a special class which can be dir
After the received Message is converted correctly, you can publish it via:

```python
RosTopicHandler.publish(robotID, topic, convertedData, dataStruct):
RosTopicHandler.publish(topic, convertedData, dataStruct):
```

and it should be published in the ROS-World automatically!
Expand Down
Loading

0 comments on commit 92c86d1

Please sign in to comment.