Class: Rclrb::QoSProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/rclrb/qos.rb

Overview

Represent the QoS profile of a topic, service or action. Look at QoSProfileSensorData, QoSProfileParameters, QoSProfileDefault, QoSProfileServicesDefault, QoSProfileParameterEvents, or QoSProfileSystemDefault.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(depth:, history: QosHistoryPolicy::KeepLast, reliability: QosReliabilityPolicy::Reliable, durability: QosDurabilityPolicy::Volatile, deadline: nil, lifespan: nil, liveliness: QosLivelinessPolicy::SystemDefault, liveliness_lease_duration: nil, avoid_ros_namespace_conventions: false) ⇒ QoSProfile

Parameters:

  • depth Size of the message queue.

  • history History QoS policy setting

  • reliability Reliabiilty QoS policy setting

  • durability Durability QoS policy setting

  • deadline The period at which messages are expected to be sent/received

  • lifespan The age at which messages are considered expired and no longer valid

  • liveliness Liveliness QoS policy setting

  • liveliness_lease_duration The time within which the RMW node or publisher must show that it is alive

  • avoid_ros_namespace_conventions If true, any ROS specific namespacing conventions will be circumvented



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/rclrb/qos.rb', line 62

def initialize(depth:, history: QosHistoryPolicy::KeepLast, reliability: QosReliabilityPolicy::Reliable,
               durability: QosDurabilityPolicy::Volatile, deadline: nil, lifespan: nil,
               liveliness: QosLivelinessPolicy::SystemDefault, liveliness_lease_duration: nil,
               avoid_ros_namespace_conventions: false)
  @ros_profile = CApi::RmwQoSProfileT.new
  @ros_profile[:depth] = depth
  @ros_profile[:history] = history
  @ros_profile[:reliability] = reliability
  @ros_profile[:durability] = durability
  unless deadline.nil?
    s, n = deadline.to_sec_nsec
    @ros_profile[:deadline][:sec] = s
    @ros_profile[:deadline][:nsec] = n
  end
  unless lifespan.nil?
    s, n = lifespan.to_sec_nsec
    @ros_profile[:lifespan][:sec] = s
    @ros_profile[:lifespan][:nsec] = n
  end
  @ros_profile[:lifespan]
  @ros_profile[:liveliness] = liveliness
  unless liveliness_lease_duration.nil?
    s, n = liveliness_lease_duration.to_sec_nsec
    @ros_profile[:liveliness_lease_duration][:sec] = s
    @ros_profile[:liveliness_lease_duration][:nsec] = n
  end
end

Instance Attribute Details

#ros_profileObject (readonly)

Returns the value of attribute ros_profile.



49
50
51
# File 'lib/rclrb/qos.rb', line 49

def ros_profile
  @ros_profile
end

Class Method Details

.get_profile(p) ⇒ Object



89
90
91
92
# File 'lib/rclrb/qos.rb', line 89

def QoSProfile.get_profile p
  return p if p.kind_of? QoSProfile
  return QoSProfile.new depth: p 
end