Skip to content

Commit 00a30a5

Browse files
feat: add ros2 bindings (#582)
* feat: add ros2 bindings * fix(bindings): add bindingVersion to ros2 bindings * fix: ROS 2 operation binding * fix: update ROS 2 server binding * feat: register ROS 2 server binging * chore: remove extra line from serverBindingsObject * feat: register ROS 2 operation binding * chore: remove extra new line from serverBindingsObject * test: register ROS 2 server and operation bindings --------- Co-authored-by: Pavel Bodiachevskii <PavelBodyachevskiy@gmail.com>
1 parent 55e6849 commit 00a30a5

File tree

5 files changed

+197
-1
lines changed

5 files changed

+197
-1
lines changed

bindings/ros2/0.1.0/operation.json

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://asyncapi.com/bindings/ros2/0.1.0/operation.json",
4+
"description": "This object contains information about the operation representation in ROS 2.",
5+
"examples": [
6+
{
7+
"node": "/turtlesim",
8+
"qosPolicies": {
9+
"deadline": "-1",
10+
"durability": "volatile",
11+
"history": "unknown",
12+
"leaseDuration": "-1",
13+
"lifespan": "-1",
14+
"liveliness": "automatic",
15+
"reliability": "reliable"
16+
},
17+
"role": "subscriber"
18+
}
19+
],
20+
"type": "object",
21+
"required": [ "role", "node" ],
22+
"properties": {
23+
"bindingVersion": {
24+
"description": "The version of this binding. If omitted, 'latest' MUST be assumed.",
25+
"type": "string",
26+
"enum": [ "0.1.0" ]
27+
},
28+
"node": {
29+
"description": "The name of the ROS 2 node that implements this operation.",
30+
"type": "string"
31+
},
32+
"qosPolicies": {
33+
"type": "object",
34+
"properties": {
35+
"deadline": {
36+
"description": "The expected maximum amount of time between subsequent messages being published to a topic. -1 means infinite.",
37+
"type": "integer"
38+
},
39+
"durability": {
40+
"description": "Persistence specification that determines message availability for late-joining subscribers",
41+
"type": "string",
42+
"enum": [ "transient_local", "volatile" ]
43+
},
44+
"history": {
45+
"description": "Policy parameter that defines the maximum number of samples maintained in the middleware queue",
46+
"type": "string",
47+
"enum": [ "keep_last", "keep_all", "unknown" ]
48+
},
49+
"leaseDuration": {
50+
"description": "The maximum period of time a publisher has to indicate that it is alive before the system considers it to have lost liveliness. -1 means infinite.",
51+
"type": "integer"
52+
},
53+
"lifespan": {
54+
"description": "The maximum amount of time between the publishing and the reception of a message without the message being considered stale or expired. -1 means infinite.",
55+
"type": "integer"
56+
},
57+
"liveliness": {
58+
"description": "Defines the mechanism by which the system monitors and determines the operational status of communication entities within the network.",
59+
"type": "string",
60+
"enum": [ "automatic", "manual" ]
61+
},
62+
"reliability": {
63+
"description": "Specifies the communication guarantee model that determines whether message delivery confirmation between publisher and subscriber is required.",
64+
"type": "string",
65+
"enum": [ "best_effort", "realiable" ]
66+
}
67+
}
68+
},
69+
"role": {
70+
"description": "Specifies the ROS 2 type of the node for this operation.",
71+
"type": "string",
72+
"enum": [
73+
"publisher",
74+
"action_client",
75+
"service_client",
76+
"subscriber",
77+
"action_server",
78+
"service_server"
79+
]
80+
}
81+
},
82+
"patternProperties": {
83+
"^x-[\\w\\d\\.\\x2d_]+$": {
84+
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
85+
}
86+
},
87+
"additionalProperties": false
88+
}

bindings/ros2/0.1.0/server.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://asyncapi.com/bindings/ros2/0.1.0/server.json",
4+
"description": "This object contains information about the server representation in ROS 2.",
5+
"examples": [
6+
{
7+
"domainId": "0",
8+
"rmwImplementation": "rmw_fastrtps_cpp"
9+
}
10+
],
11+
"type": "object",
12+
"required": [ "host", "protocol" ],
13+
"properties": {
14+
"bindingVersion": {
15+
"description": "The version of this binding. If omitted, 'latest' MUST be assumed.",
16+
"type": "string",
17+
"enum": [ "0.1.0" ]
18+
},
19+
"domainId": {
20+
"description": "All ROS 2 nodes use domain ID 0 by default. To prevent interference between different groups of computers running ROS 2 on the same network, a group can be set with a unique domain ID.",
21+
"type": "integer",
22+
"maximum": 231,
23+
"minimum": 0
24+
},
25+
"rmwImplementation": {
26+
"description": "Specifies the ROS 2 middleware implementation to be used. This determines the underlying middleware implementation that handles communication.",
27+
"type": "string"
28+
}
29+
},
30+
"patternProperties": {
31+
"^x-[\\w\\d\\.\\x2d_]+$": {
32+
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
33+
}
34+
}
35+
}

definitions/3.0.0/operationBindingsObject.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,41 @@
298298
},
299299
"stomp": {},
300300
"redis": {},
301+
"ros2": {
302+
"properties": {
303+
"bindingVersion": {
304+
"enum": ["0.1.0"]
305+
}
306+
},
307+
"allOf": [
308+
{
309+
"description": "If no bindingVersion specified, use the latest binding",
310+
"if": {
311+
"not": {
312+
"required": [
313+
"bindingVersion"
314+
]
315+
}
316+
},
317+
"then": {
318+
"$ref": "http://asyncapi.com/bindings/ros2/0.1.0/operation.json"
319+
}
320+
},
321+
{
322+
"if": {
323+
"required": [ "bindingVersion" ],
324+
"properties": {
325+
"bindingVersion": {
326+
"const": "0.1.0"
327+
}
328+
}
329+
},
330+
"then": {
331+
"$ref": "http://asyncapi.com/bindings/ros2/0.1.0/operation.json"
332+
}
333+
}
334+
]
335+
},
301336
"ibmmq": {},
302337
"solace": {
303338
"properties": {

definitions/3.0.0/serverBindingsObject.json

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,41 @@
149149
"sqs": {},
150150
"stomp": {},
151151
"redis": {},
152+
"ros2": {
153+
"properties": {
154+
"bindingVersion": {
155+
"enum": ["0.1.0"]
156+
}
157+
},
158+
"allOf": [
159+
{
160+
"description": "If no bindingVersion specified, use the latest binding",
161+
"if": {
162+
"not": {
163+
"required": [
164+
"bindingVersion"
165+
]
166+
}
167+
},
168+
"then": {
169+
"$ref": "http://asyncapi.com/bindings/ros2/0.1.0/server.json"
170+
}
171+
},
172+
{
173+
"if": {
174+
"required": [ "bindingVersion" ],
175+
"properties": {
176+
"bindingVersion": {
177+
"const": "0.1.0"
178+
}
179+
}
180+
},
181+
"then": {
182+
"$ref": "http://asyncapi.com/bindings/ros2/0.1.0/server.json"
183+
}
184+
}
185+
]
186+
},
152187
"ibmmq": {
153188
"properties": {
154189
"bindingVersion": {
@@ -284,4 +319,4 @@
284319
},
285320
"$schema": "http://json-schema.org/draft-07/schema#",
286321
"$id": "http://asyncapi.com/definitions/3.0.0/serverBindingsObject.json"
287-
}
322+
}

test/ajv-schemes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ function bindingSchemes(ajv) {
5858
ajv.addSchema(require('@bindings/pulsar/0.1.0/channel.json'));
5959
ajv.addSchema(require('@bindings/pulsar/0.1.0/server.json'));
6060

61+
ajv.addSchema(require('@bindings/ros2/0.1.0/operation.json'));
62+
ajv.addSchema(require('@bindings/ros2/0.1.0/server.json'));
63+
6164
ajv.addSchema(require('@bindings/sns/0.1.0/channel.json'));
6265
ajv.addSchema(require('@bindings/sns/0.1.0/operation.json'));
6366

0 commit comments

Comments
 (0)