Skip to content

Commit cf43823

Browse files
committed
Finish service operations
1 parent de762a2 commit cf43823

1 file changed

Lines changed: 28 additions & 59 deletions

File tree

ROSBRIDGE_PROTOCOL.md

Lines changed: 28 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -321,77 +321,46 @@ Unsubscribe from a topic to stop receiving updates.
321321

322322
Advertise an external service server. Requests come to the client via `call_service`.
323323

324-
```json
325-
{
326-
"op": "advertise_service",
327-
"type": <string>,
328-
"service": <string>
329-
}
330-
```
331-
332-
- **service** – the name of the service to advertise
333-
- **type** – the advertised service message type
324+
| Field | Required | Type | Description |
325+
|-------|----------|------|-------------|
326+
| `op` | required | string | Must be `"advertise_service"` |
327+
| `service` | required | string | The name of the service to advertise. |
328+
| `type` | required | string | The advertised service message type. |
334329

335330
#### 4.2.2 unadvertise_service (C → S)
336331

337-
Stop advertising an external ROS service server
338-
339-
```json
340-
{
341-
"op": "unadvertise_service",
342-
"service": <string>
343-
}
344-
```
332+
Stop advertising an external ROS service server.
345333

346-
- **service** – the name of the service to unadvertise
334+
| Field | Required | Type | Description |
335+
|-------|----------|------|-------------|
336+
| `op` | required | string | Must be `"unadvertise_service"` |
337+
| `service` | required | string | The name of the service to unadvertise. |
347338

348339
#### 4.2.3 call_service (C ↔ S)
349340

350-
Call a ROS service.
341+
Invoke a service.
351342

352-
```json
353-
{
354-
"op": "call_service",
355-
(optional) "id": <string>,
356-
"service": <string>,
357-
(optional) "args": <list<json>>,
358-
(optional) "fragment_size": <int>,
359-
(optional) "compression": <string>,
360-
(optional) "timeout": <float>
361-
}
362-
```
363-
364-
- **service** – the name of the service to call
365-
- **args** – if the service has no args, then args does not have to be
366-
provided, though an empty list is equally acceptable. Args should be a list
367-
of json objects representing the arguments to the service
368-
- **id** – an optional id to distinguish this service call
369-
- **fragment_size** – the maximum size that the response message can take
370-
before it is fragmented
371-
- **compression** – an optional string to specify the compression scheme to be
372-
used on messages. Valid values are "none" and "png"
373-
- **timeout** – the time, in seconds, to wait for a response from the server
343+
| Field | Required | Type | Description |
344+
|-------|----------|------|-------------|
345+
| `op` | required | string | Must be `"call_service"` |
346+
| `id` | optional | string | An ID to associate with this service call. Will be included in the response. |
347+
| `service` | required | string | The name of the service to call. |
348+
| `args` | optional | object or list | The arguments to pass to the service. Can be an object with message fields or a list of field values in the order they appear in the service definition. |
349+
| `fragment_size` | optional | integer | (only C → S) The maximum size (in bytes) a message can reach before it is fragmented. |
350+
| `compression` | optional | string | (only C → S) Compression scheme for outgoing messages. Valid values: `none`, `png`. |
351+
| `timeout` | optional | float | (only C → S) The time, in seconds, to wait for a response from the server. |
374352

375353
#### 4.2.5 service_response (C ↔ S)
376354

377-
A response to a ROS service call.
355+
Return a service response.
378356

379-
```json
380-
{
381-
"op": "service_response",
382-
(optional) "id": <string>,
383-
"service": <string>,
384-
(optional) "values": <list<json>>,
385-
"result": <boolean>
386-
}
387-
```
388-
389-
- **service** – the name of the service that was called
390-
- **values** – the return values. If the service had no return values, then
391-
this field can be omitted (and will be by the rosbridge server)
392-
- **id** – if an ID was provided to the service request, then the service
393-
response will contain the ID
394-
- **result** - return value of service callback. true means success, false failure.
357+
| Field | Required | Type | Description |
358+
|-------|----------|------|-------------|
359+
| `op` | required | string | Must be `"service_response"` |
360+
| `id` | optional | string | An ID to associate with this service response. Will match the ID of the corresponding service call if it was provided. |
361+
| `service` | required | string | The name of the service that was called. |
362+
| `values` | optional | object or string | The return values from the service or an error message if the service call failed. If the service call was successful but had no return values, this field can be omitted. |
363+
| `result` | required | boolean | The result of the service call. `true` indicates success, `false` indicates failure. |
395364

396365
### 4.3 Action operations
397366

0 commit comments

Comments
 (0)