forked from RobotWebTools/rosbridge_suite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_opcodes.txt
66 lines (53 loc) · 4.62 KB
/
new_opcodes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
notes about message field "fragment_size":
- rosbridge-client can always use fragment_size to request fragments from rosbridge if message size exceeds the given value. (set to None to disable fragmentation for a client, default = None)
notes for advertising services:
- make sure the srv-file is located in the module (/folder) as defined in advertise_service message (rosbridge server-side)
notes for general message encoding:
- sender-side: use .encode("base64","strict") to avoid parsing conflicts for data that is passed within string fields (just on the string that contains data, not the rest of the json message)
- receiver-side: use .decode("base64","strict") to decode this data when it is received
notes for using fragmentation:
- client-side defragmentation (reconstruction of original message) is required (buffer incoming data, find json-objects, access json-fields, ..)
.. this requires client-side parsing for multiple JSON-objects in incoming data/buffer/stream
- if client can only send small messages, client has to generate fragment messages by itself (split original message, put into fragment-messages, send those to rosbridge, ..)
.. rosbridge should be able to defragment those whithout further action
notes about field "message_intervall":
- if client is implemented "simple" without any advanced JSON-parsing (multiple objects) of incoming data, then be sure to set message field "message_intervall" to an appropriate value (default = 0.01 seconds)
- if client can handle many JSON-objects on incoming data, then feel free to set "message_intervall" to 0.0
- rosbridge itself should be able to parse for multiple JSON-objects (when using my modified protocol.py), so client should be safe to send messages without any delay inbetween
Examples:
{ use to advertise a service
"op":"advertise_service", : op-code
"service_module": "rosbridge_library", : module where srv-file is located (within ros)
"service_type": "SendBytes", : service type (selects srv-file)
"service_name": "send_bytes", : service name
"fragment_size": 1000, : optional, request fragments if message size is bigger than this value [default = None]
"message_intervall": 0.0 : optional, set delay between messages sent from rosbridge [default = 0.01]
}
{ use to unadvertise a service
"op":"stop_service", : op-code
"service_name": "send_bytes" : service name
}
{ use this to call a service, no matter if provided by ros or non-ros client (not added by ipa-fxm-db)
"op" : "call_service", : op-code
"service": "/send_bytes", : select service
"fragment_size": 1000, : optional, request fragments if message size is bigger than this value
"message_intervall": 0.0, : optional, set delay between messages sent from rosbridge [default = 0.01]
"args": { "count" : 26 } : args contains the service parameters as defined in srv-file
}
{ do NOT use to send requests (use call_service); this is a request from rosbridge to a non-ros-service-provider (non-ros-service-provider needs to parse it)
"op":"service_request", : op-code
"request_id": "01234-abcxyz", : send this value back to rosbridge with the service_response
"args": { "count" : 26 } : service request parameters as defined in srv-file
}
{ use to deliver a service response to rosbridge
"op": "service_response", : op-code
"request_id": "01234-abcxyz", : identifies which request this response is meant for
"data": { "data" : "abcdefghijklmnopqrstuvwxyz" } : data contaings the service response data as defined in srv-file ("data" is defined in srv-file, so we have it "twice")
}
{ automatically used by rosbridge if fragment_size is set; can be used by client (e.g. huge service_responses)
"op":"fragment", : op-code
"id": 123456, : message id
"data": "........", : contains part of a json-message (service_response, published message, ..)
"num": 0, : number of fragment
"total": 1 : total number of fragments that belong to this fragmented message
}