class

Publisher()

- Class representing a Publisher in ROS

Members

member

events

Get the event handlers for this publisher.
Source:
member

events

Set the event handlers for this publisher.
Source:
member

loggerName

Get the logger name for this publisher.
Source:
member

subscriptionCount

Get the number of subscriptions to this publisher.
Source:
member

topic :string

Type:
  • string
Source:
member

willValidateMessage :boolean

Whether messages will be validated before publishing.
Type:
  • boolean
Source:
member

willValidateMessage

Enable or disable message validation for this publisher.
Source:

Methods

function

assertLiveliness() → {undefined}

Manually assert that this Publisher is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC).
Source:
Returns:
Type undefined
function

publish(message, optionsopt) → {undefined}

Publish a message
Parameters:
Name Type Attributes Description
message object | Buffer The message to be sent, could be kind of JavaScript message generated from .msg or be a Buffer for a raw message.
options object <optional>
Publish options
Properties
Name Type Attributes Description
validate boolean <optional>
Override validateMessages setting for this publish call
Source:
Throws:
If validation is enabled and message is invalid
Returns:
Type undefined
function

setValidation(options)

Set validation options for this publisher.
Parameters:
Name Type Description
options object Validation options
Properties
Name Type Attributes Default Description
strict boolean <optional>
true Throw on unknown fields
checkTypes boolean <optional>
true Validate field types
checkRequired boolean <optional>
false Check for missing fields
Source:
function

waitForAllAcked(timeout) → {boolean}

Wait until all published message data is acknowledged or until the specified timeout elapses If the timeout is negative then this function will block indefinitely until all published message data is acknowledged. If the timeout is 0 then it will check if all published message has been acknowledged without waiting. If the timeout is greater than 0 then it will return after that period of time has elapsed or all published message data is acknowledged. Raises an error if failed, such as the middleware not supporting this feature.
Parameters:
Name Type Description
timeout timeout The duration to wait for all published message data to be acknowledged in nanoseconds.
Source:
Returns:
`true` if all published message data is acknowledged before the timeout, otherwise `false`.
Type boolean