Skip to content

Commit 4b7211f

Browse files
committed
restructure
1 parent ac0b889 commit 4b7211f

File tree

1 file changed

+76
-56
lines changed

1 file changed

+76
-56
lines changed

articles/rosbags.md

+76-56
Original file line numberDiff line numberDiff line change
@@ -27,80 +27,48 @@ The technical challenges shall be examined within this article.
2727
We shall the discuss the requirements on such a tool, the technical challenges and changes to be made to the current ROS2.0 system.
2828

2929

30-
## Requirements
30+
## Requirements for storage format
3131

32-
### API for recording and replaying
32+
To be chosen from section "Relaxed or dismissed requirements" in the "Alternatives" section
3333

34-
The most important requirement for rosbags is being capable to record all available topics with minimal deserializing overhead.
35-
We shall therefore implement a set of functions in the rmw layer, which allows users to take messages raw, meaning in a serialized form object to the underlying middleware.
36-
In the case of DDS, such a raw message shall correspond to the CDR data being sent over the wire.
37-
Simultaneously, there shall be an API to convert a ROS2.0 message into its binary representation, such as CDR, in order to record data which is not being sent over the wire but created manually.
3834

39-
The same requirements are set for publishing stored data, where already serialized data shall be transmitted over the wire without the need of serializing.
40-
Analog to taking a message in its raw format, we shall implement a rmw function which allows publishing a raw message on a topic.
41-
In order to read a serialized message from a rosbag, we shall have a function which converts a serialized binary representation in its corresponding ROS2.0 message.
35+
## Proposal for data storage format
4236

43-
Given the requirements above, we propose the following rmw API:
37+
To be chosen from section "Dismissed data storage formats" in the "Alternatives" section
4438

45-
```c
46-
rmw_ret_t
47-
rmw_take_raw(const rmw_subscription_t * subscription, rmw_message_raw_t * raw_message, bool * taken);
4839

49-
rmw_ret_t
50-
rmw_to_raw_message(const void * ros_message, const rosidl_message_type_support_t * type_support, rmw_message_raw_t * raw_message);
40+
## Alternatives
5141

52-
rmw_ret_t
53-
rmw_publish_raw(const rmw_publisher_t * publisher, const rmw_message_raw_t * raw_message);
42+
### Relaxed or dismissed requirements
43+
We need a data storage format which allows to sufficiently store and replay transmitted data with the least possible cost overhead.
44+
There are a few requirements for writing and reading to such a data storage format:
5445

55-
rmw_ret_t
56-
rmw_from_raw_message(const void * rmw_message_raw_t, const rosidl_message_type_support_t * type_support, void * ros_message);
57-
```
46+
#### Scalability
47+
The chosen format has to scale up to multiple terabytes of file size.
5848

59-
The in the code snippet mentioned raw message shall be defined as follows:
49+
#### Parallelism
50+
It must be possible to write to the file from multiple instances at the same time.
6051

61-
```c
62-
typedef struct rmw_message_raw_t
63-
{
64-
unsigned int length;
65-
char * raw_data;
66-
} rmw_message_raw_t;
67-
```
52+
#### Compression
53+
When the file size becomes larger, it should be possible to compress the file for long time archiving.
6854

69-
The `raw_data` field shall contain all message data needed to extract a ROS message given a respective type support, which contains all necessary information on how to concert the raw data into its corresponding ros message type.
70-
An example for CDR data in case of DDS:
55+
#### Random access
56+
It must be possible to grant random read access to the file and extract specific individual messages.
57+
Random access further means that it should be possible to extract the n-th message of one topic.
7158

72-
The ROS message string
73-
```
74-
std_msgs::msg::String msg;
75-
msg.data = "hello world 42";
76-
```
77-
translates into a rmw_message_raw_t
78-
```
79-
length: 24
80-
data (in hex): 0x00 0x01 0x00 0x00 0x0f 0x00 0x00 0x00 0x68 0x65 0x6c 0x6c 0x6f 0x20 0x77 0x6f 0x72 0x6c 0x64 0x20 0x34 0x32 0x00 0x00
81-
```
82-
83-
84-
### Requirements for storage format
85-
86-
Given the API proposed in the above section, we need a data storage format which allows to sufficiently store and replay this serialized data.
87-
There are a few requirements for writing to such a data storage format:
88-
89-
- Scalability: The chosen format has to scale up to multiple terabytes of file size.
90-
- Parallelism: It must be possible to write to the file from multiple instances at the same time.
91-
- Compression (might be relaxed): Ideally, when the file size becomes larger, it should be possible to compress the file for long time archiving.
59+
#### Range access
60+
It further should be possible to only replay/read a section of the record, specified by a range of time.
61+
It should be possible to access a range of messages in terms of timestamps from `tx` to `tx+n`.
9262

93-
In terms of reading from the file, there are similar requirements:
94-
95-
- Random access: It must be possible to grant random read access to the file and extract specific individual messages.
96-
- Range access: It further should be possible to only replay/read a section of the record, specified by a range of time.
97-
- Chunk sizes: The chunk sizes must be configurable to fit various large message types.
63+
#### Variable Chunk sizes
64+
The chunk sizes must be configurable to fit various large message types in order to stay performant even with large data messages.
9865

66+
#### Backwards compatible with ROS1
9967
A general requirement is to be backwards compatible with existing ROS1 bags.
10068
This compatibility can either be via a conversion script, which permanently converts ROS1 bags into ROS2 bags or a bridge API which allows to manually open existing ROS1 bags and publish them into the ROS2 system.
10169

10270

103-
## Evaluation of possible data storage formats
71+
### Dismissed data storage formats
10472

10573
In the following, we are iterating over a couple of data formats, which may be suitable for the underlying ROSbag implementation.
10674
We hereby iterate over existing third party software as well as examining of maintaining a self-made format.
@@ -150,3 +118,55 @@ The Gazebo team created a nicely composed [comparison](https://osrfoundation.atl
150118
- Ability to query the tables with classical relational SQL syntax.
151119

152120
#### Cons
121+
122+
123+
## API for recording and replaying
124+
125+
The most important requirement for rosbags is being capable to record all available topics with minimal deserializing overhead.
126+
We shall therefore implement a set of functions in the rmw layer, which allows users to take messages raw, meaning in a serialized form object to the underlying middleware.
127+
In the case of DDS, such a raw message shall correspond to the CDR data being sent over the wire.
128+
Simultaneously, there shall be an API to convert a ROS2.0 message into its binary representation, such as CDR, in order to record data which is not being sent over the wire but created manually.
129+
130+
The same requirements are set for publishing stored data, where already serialized data shall be transmitted over the wire without the need of serializing.
131+
Analog to taking a message in its raw format, we shall implement a rmw function which allows publishing a raw message on a topic.
132+
In order to read a serialized message from a rosbag, we shall have a function which converts a serialized binary representation in its corresponding ROS2.0 message.
133+
134+
Given the requirements above, we propose the following rmw API:
135+
136+
```c
137+
rmw_ret_t
138+
rmw_take_raw(const rmw_subscription_t * subscription, rmw_message_raw_t * raw_message, bool * taken);
139+
140+
rmw_ret_t
141+
rmw_to_raw_message(const void * ros_message, const rosidl_message_type_support_t * type_support, rmw_message_raw_t * raw_message);
142+
143+
rmw_ret_t
144+
rmw_publish_raw(const rmw_publisher_t * publisher, const rmw_message_raw_t * raw_message);
145+
146+
rmw_ret_t
147+
rmw_from_raw_message(const void * rmw_message_raw_t, const rosidl_message_type_support_t * type_support, void * ros_message);
148+
```
149+
150+
The in the code snippet mentioned raw message shall be defined as follows:
151+
152+
```c
153+
typedef struct rmw_message_raw_t
154+
{
155+
unsigned int length;
156+
char * raw_data;
157+
} rmw_message_raw_t;
158+
```
159+
160+
The `raw_data` field shall contain all message data needed to extract a ROS message given a respective type support, which contains all necessary information on how to concert the raw data into its corresponding ros message type.
161+
An example for CDR data in case of DDS:
162+
163+
The ROS message string
164+
```
165+
std_msgs::msg::String msg;
166+
msg.data = "hello world 42";
167+
```
168+
translates into a rmw_message_raw_t
169+
```
170+
length: 24
171+
data (in hex): 0x00 0x01 0x00 0x00 0x0f 0x00 0x00 0x00 0x68 0x65 0x6c 0x6c 0x6f 0x20 0x77 0x6f 0x72 0x6c 0x64 0x20 0x34 0x32 0x00 0x00
172+
```

0 commit comments

Comments
 (0)