Class QosOptions

Class Documentation

class QosOptions

Options for overriding QoS settings.

Public Functions

QosOptions() = default

Constructor.

Default values:

  • reliability = nullopt_t (detect automatically)

  • durability = nullopt_t (detect automatically)

  • history = rclcpp::HistoryPolicy::KeepLast

  • depth = 10

  • deadline = 0 (RMW default)

  • lifespan = 0 (RMW default)

std::optional<rclcpp::ReliabilityPolicy> reliability() const

Get reliability.

QosOptions &reliability(const rclcpp::ReliabilityPolicy &reliability)

Set reliability.

std::optional<rclcpp::DurabilityPolicy> durability() const

Get durability.

QosOptions &durability(const rclcpp::DurabilityPolicy &durability)

Set durability.

rclcpp::HistoryPolicy history() const

Get history.

QosOptions &history(const rclcpp::HistoryPolicy &history)

Set history.

size_t depth() const

Get history depth.

QosOptions &depth(const size_t &depth)

Set history depth.

std::optional<int64_t> deadline() const

Get deadline in nanoseconds.

If nullopt_t is returned, then use automatic matching.

QosOptions &deadline(int64_t deadline)

Set deadline.

Parameters:

deadline – number of nanoseconds. If zero, then use the RMW default policy. If negative, then it is treated an “infinite” (max number of nanoseconds).

QosOptions &deadline_auto()

Set deadline policy to automatically match available publishers.

std::optional<int64_t> lifespan() const

Get lifespan in nanoseconds.

If nullopt_t is returned, then use automatic matching.

QosOptions &lifespan(int64_t lifespan)

Set lifespan in nanoseconds.

Parameters:

lifespan – number of nanoseconds. If zero, then use the RMW default policy. If negative, then it is treated an “infinite” (max number of nanoseconds).

QosOptions &lifespan_auto()

Set lifespan policy to automatically match available publihsers.

std::optional<rclcpp::LivelinessPolicy> liveliness() const

Get liveliness.

QosOptions &liveliness(const rclcpp::LivelinessPolicy &liveliness)

Set history.

QosOptions &liveliness_auto()

Set liveliness policy to automatically match available publishers.

std::optional<int64_t> liveliness_lease_duration() const

Get liveliness.

QosOptions &liveliness_lease_duration(int64_t liveliness_lease_duration)

Set history.