LoginSignup
3
1

More than 1 year has passed since last update.

ROS2におけるQoS

Posted at

ROS2関係トップページへ

publisher/subscriberにて使用されるQoSは通信品質にかかわる設定である.create_publicher()create_subscription()のコンストラクタで呼び出される.

使用方法

create_publisher関数のapi referenceにて使用例があり,分かりやすいので抜粋する.

pub = node->create_publisher<MsgT>("chatter", 10);  // implicitly KeepLast
pub = node->create_publisher<MsgT>("chatter", QoS(10));  // implicitly KeepLast
pub = node->create_publisher<MsgT>("chatter", QoS(KeepLast(10)));
pub = node->create_publisher<MsgT>("chatter", QoS(KeepAll()));
pub = node->create_publisher<MsgT>("chatter", QoS(1).best_effort().volatile());
{
  rclcpp::QoS custom_qos(KeepLast(10), rmw_qos_profile_sensor_data);
  pub = node->create_publisher<MsgT>("chatter", custom_qos);
}

詳しい使用方法は公式のQoSのapi referenceを参照のこと.

QoS(size_t history_depth)

正確には以下のような宣言となる.

clcpp::QoS::QoS (size_t history_depth)

以下のような使用方法で,QoS(KeepLast(10))と同じ.

QoS(10)

QoS(const QoSInitialization& qos_init, const rmw_qos_profile_t& init)

正確には以下のような宣言となる.

rclcpp::QoS::QoS(
  const QoSInitialization & qos_initialization,
  const rmw_qos_profile_t & initial_profile = rmw_qos_profile_default
)   

qos_initializationとしてKeepLast()およびKeepAll()が使用できる.QoSInitializationのapi referenceのDetailed Descriptionを参考のこと.

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1