Skip to content

Commit bfb67f2

Browse files
authored
Remap syntax support URL scheme (#165)
1 parent 21ee15b commit bfb67f2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

articles/141_static_remapping.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ These use cases are being considered for remapping in ROS 2:
7777
- Remap via Command Line
7878
- Change the Default Namespace
7979
- Change the Node Name
80+
- Remap Topic and Service Names Separately
8081

8182
### Remap One Node in a Process
8283

@@ -198,6 +199,16 @@ ROS 1 has this feature using the argument `__node`.
198199
- User changes the node name to `left_camera_driver`
199200
- The final name is `/ns/left_camera_driver/camera_info` and log messages use `left_camera_driver`
200201

202+
### Remap Topic and Service Names Separately
203+
204+
This is the ability to create a rule that will remap only topics or only services.
205+
206+
*Example:*
207+
208+
- Node subscribes to a topic `/map` and offers a service `/map`
209+
- User changes the topic name to `/map_stream`
210+
- The node is subscribed to topic `/map_stream` and offers a service `/map`
211+
201212
## Remapping Names in ROS 1
202213

203214
Remapping is a feature that also exists in ROS 1.
@@ -225,6 +236,7 @@ Use cases supported by this syntax:
225236
- Remap via Command Line
226237
- Change the Default Namespace
227238
- Change the Node Name
239+
- Remap Topic and Service Names Separately
228240

229241
Not supported:
230242

@@ -251,11 +263,17 @@ The match part of a rule uses these operators:
251263

252264
- `*` matches a single token
253265
- `**` matches zero or more tokens delimited by slashes
266+
- `rosservice://` prefixed to the match makes the rule apply to only services
267+
- `rostopic://` prefixed to the match makes the rule apply to only topics
254268
- `nodename:` prefixed to the match makes it apply only to a node with that name
255269

256270
The operators `*` and `**` are similar to the globbing behavior in bash.
257271
`**` behaves similar to its use in bash>=4.0 with the globstar option set.
258272

273+
The URL schemes `rosservice://` and `rostopic://` may only be given to topic or service name rules.
274+
They may not be prefixed to a node name or namespace replacement rule (`__node` or `__ns`).
275+
If both a node name prefix and URL scheme are given, the node name prefix must come first.
276+
259277
`*`, and `**` match whole tokens only.
260278
`*bar` looks like it would match `foobar`, but that would mean matching a partial token.
261279
To avoid confusion they are required to be separated from tokens, substitutions, and each other by a `/`.
@@ -281,6 +299,9 @@ These references are required to be separated from tokens by a `/`.
281299
When this creates a name with `//` one slash is automatically deleted.
282300
For example `**/bar:=/bar/\1` matches the name `/foo/bar` with `**` capturing `/foo`, but the new name is `/bar/foo`.
283301

302+
The replacement part of a rule may not have a URL scheme.
303+
This is to avoid a mismatch between the scheme type of the match side and of the replacement side.
304+
284305
The substitution operators (`~` and `{}`) are replaced first.
285306
Afterwards the reference operators are replaced with the matched content.
286307
Then if the replacment name does not begin with `/` it is automatically prefixed with the node's default namespace to make it a FQN.
@@ -411,6 +432,16 @@ All private names are expanded to the new name before any remapping rules are ap
411432
- `__node:=lef_camera_driver`
412433
- `camera_driver:__node:=left_camera_driver`
413434

435+
#### Supporting: Remap Topic and Service Names Separately
436+
Specifying a URL scheme on the match side of the rule makes it exclusive to one type of name.
437+
If no URL scheme is given then the rule applies to both topics and services.
438+
439+
*Examples:*
440+
441+
- `rosservice:///foo/bar:=/bar/foo`
442+
- `rostopic://foo/bar:=bar/foo`
443+
- `nodename:rosservice://~/left:=~/right`
444+
414445
#### Not Supporting: Change a Token
415446

416447
The syntax can't change all uses of a token with one rule.

0 commit comments

Comments
 (0)