Send

Synopsis

rsb send [OPTIONS] EVENT-SPEC [DESTINATION-URI]

Description

Send an event constructed according to EVENT-SPEC to listeners on scopes specified by DESTINATION-URI.

EVENT-SPEC is treated as follows:

  • As the empty payload when it is the empty string
  • As the respective Boolean value when equal to true or false
  • As string when surrounded with double-quotes (")
  • As integer number when consisting of digits without decimal point
  • As float number when consisting of digits with decimal point
  • If EVENT-SPEC starts with /, it is parsed as a scope.
  • If EVENT-SPEC is the single character -``or the string ``-:binary, the entire “contents” of standard input (until end of file) is read as a string or octet-vector respectively and sent.
  • If EVENT-SPEC is of one of the forms #P"PATHNAME", #P"PATHNAME":ENCODING or #P"PATHNAME":binary, the file designated by PATHNAME is read into a string (optionally employing ENCODING) or octet-vector and sent.
  • If EVENT-SPEC is of the form pb:.MESSAGE-TYPE-NAME:{FIELDS}, a protocol buffer message of type MESSAGE-TYPE-NAME is constructed and its fields are populated according to FIELDS. FIELDS uses the syntax produced/consumed by the various TextFormat classes of the protocol buffer API and the --decode/--encode options of the protoc binary.
  • If EVENT-SPEC is of one the forms pb:.MESSAGE-TYPE-NAME:#P"PATHNAME" or pb:.MESSAGE-TYPE-NAME:#P"PATHNAME":ENCODING, a protocol buffer message of type MESSAGE-TYPE-NAME is constructed according to the contents of the file designated by PATHNAME.

Note

When written as part of a shell command, some of the above forms may require protection from processing by the shell, usually by surrounding the form in single quotes (‘). For example:

$ rsb send '' ...            # empty payload
$ rsb send '#P"my-file"' ... # read payload from my-file

DESTINATION-URI designates the destination scope to which the events should be sent and the transport configuration which should be used for sending the event.

See also

URIs
For details regarding the URI syntax of DESTINATION-URI for specifying transport and scope.
Common Commandline Options
The usual commandline options are accepted.
IDL-related Commandline Options
The usual IDL-related options are accepted.
--method METHOD

Set the method field of the event being sent to METHOD. Default behavior is sending an event without method field.

--meta-data, -D NAME=VALUE

Set the meta-data item NAME to VALUE in the event being sent. This option can be specified multiple times for distinct NAME s.

--timestamp, -T NAME=YYYY-MM-DD[THH:MM:SS[.µµµµµµ[+ZH:ZM]]]

Set the timestamp named NAME to VALUE in the event being sent. This option can be specified multiple times for distinct NAME s.

--cause, -c PARTICIPANT-ID:SEQUENCE-NUMBER

Add the event id specified by PARTICIPANT-ID:SEQUENCE-NUMBER to the cause vector of the event being sent. This option can be specified multiple times.

Examples

  • $ rsb send '' 'spread:/mycomponent/state'
    

    Send an event without a payload to the channel designated by the scope /mycomponent/trigger.

    Note

    Note the use of single quotes (') to allow specifying an empty payload.

  • $ rsb send '"running"' 'spread:/mycomponent/state'
    

    Send an event whose payload is the string running to the channel designated by the scope /mycomponent/state.

    Note

    Note the use of single quotes (') to prevent the shell from processing the double quotes (") that identify the payload as a string.

  • $ rsb send 5 'spread:/somescope?name=4803'
    

    Send an integer. Use Spread transport, like in the previous example, but use the “daemon name” option of the Spread transport instead of specifying host and port.

    Note

    Note the use of single quotes (') to prevent elements of the destination URI from being processed by the shell (not necessary for all shells).

  • $ cat my-data.txt | rsb send - 'socket:/printer'
    $ cat my-data.txt | rsb send -:binary 'socket:/printer'
    $ rsb send '#P"my-data.txt"' 'socket:/printer'
    $ rsb send '#P"my-data.txt":latin-1' 'socket:/printer'
    $ rsb send '#P"my-data.txt":binary' 'socket:/printer'
    

    Two ways of sending the content of the file my-data.txt to the scope /printer using the socket transport (with its default configuration). This form can only be used for sending string payloads.

    Note

    Note the use of single quotes (') to prevent elements of the pathname #"Pmy-data.txt" from being processed by the shell.

  • $ rsb send                                                  \
      -I…/rst-proto/proto/stable/                               \
      -l…/rst-proto/proto/stable/rst/robot/RobotCollision.proto \
      'pb:.rst.robot.RobotCollision:{kind: "SELF" collision_detail: { geometry: { contact_points: [ { x: 0 y: 1 z: 2 frame_id: "foo" }, { x: 3 y: 4 z: 5 } ] } object_1: "o1" } }' \
      socket:/collisions
    

    In the above example, the send tool is used to send a protocol buffer message to scope /collisions. The protocol buffer message is of type rst.robot.RobotCollision with kind enum field set to SELF and an embedded rst.kinematics.ObjectCollision message with two contact points in the collision_detail field.

    The specification of the message content uses the syntax produced/consumed by the various TextFormat classes of the protocol buffer API and the --decode/--encode options of the protoc binary.

    Note

    Note how the definition of the protocol buffer message type is loaded using -I (--idl-path) and -l (--load-idl) commandline options.

Implementations

Implementation Language Project Repository Link
Common Lisp rsb-tools-cl “0.13” branch of https://code.cor-lab.org/git/rsb.git.tools-cl