Skip to content

Commit 153513a

Browse files
committed
minor update for interface and design.
Signed-off-by: Tomoya.Fujita <[email protected]>
1 parent f715106 commit 153513a

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

articles/content_filtering.md

+27-30
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ the following create/delete API's are defined,
130130
- create_contentfilteredtopic()
131131
- delete_contentfilteredtopic()
132132

133-
**According to the specification, filter_expression can be only initialized at constructor and it is read_only. so not possible to change the filter_exThis needs to be discussed to see if we have our specific requirement for expression syntax. but that will make conversion overhead.ed at runtime. [RTI v5.3.0](https://community.rti.com/static/documentation/connext-dds/5.3.0/doc/api/connext_dds/api_cpp2/classdds_1_1topic_1_1ContentFilteredTopic.html#a76310bf0b7123dd89afbacf43dbabf4a) can support this requirement.**
133+
**According to the specification, filter_expression can be only initialized at constructor and it is read_only. probably it is not possible to change the filter_expression at runtime based on the specification but [RTI v5.3.0](https://community.rti.com/static/documentation/connext-dds/5.3.0/doc/api/connext_dds/api_cpp2/classdds_1_1topic_1_1ContentFilteredTopic.html#a76310bf0b7123dd89afbacf43dbabf4a) can support this requirement. After all, it seems that it is dependent on implementation.**
134134

135135
#### DDSI-RTPS
136136

@@ -145,22 +145,18 @@ The ContentFilterProperty_t field provides all the required information to enabl
145145

146146
### Requirement
147147

148-
- ContentFilteredTopic interfaces can be used only if implementation supports.
148+
- ContentFilteredTopic interfaces can be used only if rmw implementation supports.
149149
- If rmw implementation does not support ContentFilteredTopic interfaces, filtering will be done internally on subscriber side in `rcl`.
150150
- It can create/destroy ContentFilteredTopic based on parent topic.
151151
- It can set/get the filter_expression and expression_parameters for ContentFilteredTopic.
152152
- Filtering expression and expression parameters can be set and get at runtime.
153-
- As decribed above, according to DDS specification, it implies that filtering expression may not be able to be changed dynamically. But to support requirements in ROS2, it must support dynamic reconfiguration for filtering expression and paramter.
153+
- As described above, according to DDS specification, it implies that filtering expression may not be able to be changed dynamically. But to support requirements in ROS2, it should be able to support dynamic reconfiguration for filtering expression and parameter.
154154
- Filtering goal id for action `feedback` and `status` will be done ROS2 system.
155-
- User can specify node name and parameter name to filter the parameter evetns.
156-
- Filtering expression and parameter grammer will be the same with DDS standard between `rcl` and `rmw`.
155+
- User can specify node name and parameter name to filter the parameter events.
156+
- Filtering expression and parameter grammar will be the same with DDS standard.
157157

158158
### Proposal
159159

160-
#### Namespace
161-
162-
Since ContentFilteredTopic is based on parent topic (more like base topic), it will create ContentFilteredTopic internally, not exposed as ordinary topic.
163-
164160
#### Action
165161

166162
Each action client id to ContentFilteredTopic based on `action_name/_action/feedback_or_status`. ContentFilteredTopic name would be action_name/_action/feedback_or_status_ActionClient_ID then ActionClient always get feedback events related to goal handler. This granularity is mandatory for action feedback and status topic to have more transport efficiency.
@@ -170,24 +166,24 @@ Each action client id to ContentFilteredTopic based on `action_name/_action/feed
170166
| action_name/_action/feedback_ActionClient_ID | feedback ContentFilteredTopic for ActionClient ID, ActionClient_ID would be uuid (consistent with status id for the same client) |
171167
| action_name/_action/status_ActionClient_ID | status ContentFilteredTopic for ActionClient ID, ActionClient_ID would be uuid (consistent with feedback id for the same client) |
172168

173-
(*) These ContentFilteredTopic should not show up to user. (e.g `ros2 topic list`)
169+
(*) These ContentFilteredTopic should not show up to user but parent topic. (e.g `ros2 topic list`)
174170

175-
`feedback` topic is user defined message type but it also includes goal id([GoalInfo](https://github.com/ros2/rcl_interfaces/blob/master/action_msgs/msg/GoalInfo.msg)). Goal id will be internally handled and client issues ContentFilteredTopic API to notify the publication(server) what subscription(client) is interested in. `st- [T.B.D] This needs to be discussed more, if user should be able to filter arbitrary parameter or not. if to support any expression and parameter, it means that `rcl` needs to have DDS standard expression and parameter filtering function. new goal id will be applied to ContentFilteredTopic object based on action client ID.
171+
`feedback` topic is user defined message type but it also includes goal id([GoalInfo](https://github.com/ros2/rcl_interfaces/blob/master/action_msgs/msg/GoalInfo.msg)). Goal id will be internally handled and action client internally issues ContentFilteredTopic API to notify the publication(server) what subscription(client) is interested in. Once new goal id is generated, that will be applied to ContentFilteredTopic object based on action client ID at runtime. In action use case, it does not need to change filtering expression at runtime. instead of that it can use `MATCH` syntax with goal ids in expression parameters.
176172

177173
<img src="../img/content_filter/action_sequence_with_filter.png">
178174

179175
#### Parameter Events
180176

181177
There are two types of parameter events subscription, one is for system(TimeSource) which is controlled and taken care by rclcpp and rclpy internally. And the other is user application to register user callback to be fired when parameter events come in.
182178

183-
It would be good to create ContentFilteredTopic for each of them. This can make responsibility clear and simple, can avoid the complication about filtering expression merge between user filtering and system filtering.
179+
It would be good to create ContentFilteredTopic for each of them. This can make responsibility clear and simple, it also can avoid the complication about filtering expression merge between user filtering and system filtering.
184180

185181
| ContentFilterTopic | Description |
186182
| :--- | :--- |
187183
| /parameter_events_system_Node_ID | parameter events ContentFilteredTopic for system internal usage, Node ID would be uuid to identify this NodeBase. |
188184
| /parameter_events_user_Node_ID | parameter events ContentFilteredTopic for user callback usage, Node ID would be uuid to identify this NodeBase. |
189185

190-
(*) These ContentFilteredTopic should not show up to user. (e.g `ros2 topic list`)
186+
(*) These ContentFilteredTopic should not show up to user but ordinary topic. (e.g `ros2 topic list`)
191187

192188
- TimeSource
193189
**use_sim_time** event on self-node_base is subscribed internally to check if **use_sim_time** parameter is changed or not. so internally this **use_sim_time** AND self node name always must be in filter_expression and expression_parameters via ContentFilteredTopic if it is supported. see [here](https://github.com/ros2/rclcpp/blob/99286978f92c30fe171313bf0785d6b6272c3257/rclcpp/src/rclcpp/time_source.cpp#L123-L125).
@@ -197,11 +193,11 @@ It would be good to create ContentFilteredTopic for each of them. This can make
197193
This `use_sim_time` can be supported local callbacks, it does not have to use `/parameter_events` at all.
198194

199195
- User frontend (rclcpp/rclpy)
200-
User API will be added to manage filtering configuration, so that user application can set its own filter_expression and expression_parameters. Also using AsyncParametersClient::on_parameter_event, user can take care of the parameter event with user callback only for filtered parameter events. It should be compatible interface for user application even if rmw_implementation does not support ContentFilteredTopic. If rmw_impelementation does not support ContentFilteredTopic, `rcl` will take care of filtering instead based on fitlering expression and parameters.
196+
User API will be added to manage filtering configuration, so that user application can set its own filter_expression and expression_parameters. Also using AsyncParametersClient::on_parameter_event, user can take care of the parameter event with user callback only for filtered parameter events. It should be compatible interface for user application even if rmw_implementation does not support ContentFilteredTopic. If rmw_implementation does not support ContentFilteredTopic, `rcl` will take care of filtering instead based on filtering expression and parameters.
201197

202198
- Filtering Expression and Parameters
203-
User can specify node name and parameter name to filter the parameter evetns.
204-
- [T.B.D] This needs to be discussed more, if user should be able to filter arbitrary parameter or not. if to support any expression and parameter, it means that `rcl` needs to have DDS standard expression and parameter filtering function.
199+
User can specify node name and parameter name to filter the parameter events.
200+
- ***This needs to be discussed more, if user should be able to filter arbitrary parameter or not.***
205201

206202
<img src="../img/content_filter/parameter_event_sequence_with_filter.png">
207203

@@ -211,14 +207,16 @@ It would be good to create ContentFilteredTopic for each of them. This can make
211207

212208
- add API `is_cft_supported` to allow frontend(rclcpp/rclpy) can know CFT is supported or not.
213209
e.g) `rcl_subscription_is_cft_supported` to access `is_cft_supported`.
214-
- add `rcl_create_cft_subscription` to call `rmw_create_cft_subscription`.
215-
- add `rcl_cft_set/get_expression_parameters` to call `rmw_cft_set/get_expression_parameters`.
210+
- extend `rcl_create_subscription` with optional filtering expression and parameter expressions.
211+
- add `rcl_<set/get>_expression_parameters` to call `rmw_<set/get>_expression_parameters`.
216212

217213
#### rmw
218214

219215
- add new member `is_cft_supported` into `rmw_subscription_t` which indicates if CTF is supported by rmw_implementation or not.
220216
e.g) see `can_loan_masseges` member as reference.
221-
support status will be set when parent subscription is created. then support status can be used to notify the upper layer if CFT is supported or not.
217+
support status will be set when parent subscription is created. then support status can be read from upper layer to know if CFT is supported or not.
218+
219+
- current support status
222220

223221
| Implementation | `is_cft_supported` |
224222
| :--: | :--: |
@@ -228,32 +226,31 @@ It would be good to create ContentFilteredTopic for each of them. This can make
228226

229227
- new `DDSContentFilteredTopic` object needs to be managed in implementation.
230228
- parent topic information should be cached so that we can create CFT based on that parent topic.
231-
- `rmw_create_cft_subscription` interface.
232-
- input: rmw_subscription_t, rmw_node_t, parent topic information.
233-
- output: rmw_subscription_t (with new data reader)
234-
- `rmw_cft_set/get_expression_parameters` interface.
229+
- extemd `rmw_create_subscription` with optional fileds.
230+
- const char * filter_expression
231+
- const rcutils_string_array_t * expression_parameters
232+
- `rmw_<set/get>_expression_parameters` interface.
235233
- input: rmw_subscription_t, (string sequence) expression parameters.
236234

237-
#### rclcpp(rclpy)
235+
#### rclcpp (rclpy)
238236

239237
**[T.B.D] Do we need to expose ContentFilteredTopic for user classes?**
240238

241-
- `create_cft_subscription` method in `Node` & `Subscription` class to allow user application to user CFT feature based on parent topics and subscription.
239+
- extend `create_subscription` method with optional fields in `Node` & `Subscription` class to allow user application to user CFT feature based on parent topics and subscription.
242240
- if the platform does not support CFT, the return NOT_SUPPORTED.
243-
- this will override the subscription (datareader in dds), so that we can have single datareader in dds. this means that subscription can only subscribe content filtered data.
244-
- `set_cft_set/get_expression_parameters` method in `Node` class to set and get expression parameters. (Not possible set filtering expression at runtime this is specification of DDS.)
241+
- if optional fields are specified, ContentFilteredTopic and corresponding subscription (datareader in dds) this means that subscription can only subscribe content filtered data.
242+
- `set_<set/get>_expression_parameters` method in `Node` class to set and get expression parameters.
245243
- Deletion/Destruction of CFT subscription is exactly same with current subscription routine.
246244

247245
### Components
248246

249247
#### Action
250248

251249
- Action Server
252-
Nothing needs to be changed, even with ContentFilteredTopic it should not be aware of that, just publishes feedback and status message, the rest will be taken care by rmw_implementation. if rmw_implementation does not support ContentFilteredTopic, filtering process is done by subscriber side which is Action Client.
250+
Nothing needs to be changed, even with ContentFilteredTopic it should not be aware of that, just publishes feedback and status message, the rest will be taken care by rmw_implementation. if rmw_implementation does not support ContentFilteredTopic, filtering process is done by subscriber side which is Action Client as it does now.
253251

254252
- Action Client
255-
User interface(rclcpp and rclpy) should not be changed, everything can be integrated into internal implementation.
256-
It will check if ContentFilter is supported by rmw_implementation internally. If ContentFilter is supported by rmw_implementation, create ContentFilteredTopic internally based on ActionClient ID (uuid) so that no need to filter goal id. (saying there will be no unknown goal id event.) But w/o ContentFilter [current filtering](https://github.com/ros2/rclcpp/blob/99286978f92c30fe171313bf0785d6b6272c3257/rclcpp_action/include/rclcpp_action/client.hpp#L536-L553) needs to stay since there would be unnecessary message from publisher.At [send_goal_request](https://github.com/ros2/rclcpp/blob/99286978f92c30fe171313bf0785d6b6272c3257/rclcpp_action/include/rclcpp_action/client.hpp#L352-L388), it will set the filter_expression and expression_parameters based on goal id. The goal handler might have multiple goal ids, so that get current filtering configuration, modify and set new filtering configuration. (the finalization is also needed when goal id is being unregistered from goal handler.)
253+
User interface(rclcpp and rclpy) should not be changed, everything can be integrated into internal implementation. It will check if ContentFilter is supported by rmw_implementation internally. If ContentFilter is supported by rmw_implementation, create ContentFilteredTopic internally based on ActionClient ID (uuid) so that no need to filter goal id. (technically there will be no unknown goal id event.) But w/o ContentFilter [current filtering](https://github.com/ros2/rclcpp/blob/99286978f92c30fe171313bf0785d6b6272c3257/rclcpp_action/include/rclcpp_action/client.hpp#L536-L553) needs to stay just in case, there would be unnecessary message from publisher or different rmw_implementation which does not support ContentFilteredTopic is used on Action Server side. At [send_goal_request](https://github.com/ros2/rclcpp/blob/99286978f92c30fe171313bf0785d6b6272c3257/rclcpp_action/include/rclcpp_action/client.hpp#L352-L388), it will set the filter_expression and expression_parameters based on goal id. The goal handler might have multiple goal ids, so that get current filtering configuration, modify and set new filtering configuration. (the un-registration is also needed when goal id is being unregistered from goal handler.)
257254

258255
#### Parameter Event
259256

0 commit comments

Comments
 (0)