Try   HackMD

Updated: 2023/08/08

Block Diagram

fig_1

QoS Update Detail

The QoS update process can be simply separated in three steps:

  1. Get update signal from QoS server via topic
  2. Send request to QoS server to get topic name's QoS profile
  3. Response QoS profile for topic name and update QoS

For initial state QoS setting, ignore first step and request QoS profile just once. Otherwise, for dynamic QoS updating, several rules need to be followed:

  1. The QoS server must have a QoS ID (qid) to describe the current status of all QoS profile settings, and the qid must be unique. The qid changes if and only if some of QoS profile changes.
  2. The QoS publisher (server side) sends QoS ID (qid) and string array (topic_table) as the update signal. The topic_table shows the specific topics which QoS profile had been changed, and qid describes the whole current QoS profiles in QoS server. Subscriber (client side) can easily identify qid to prevent updating the same QoS profile.
  3. While the device (client) finished the QoS update process, remember to record the qid, the QoS server can also record which client finish the QoS update process, to decrease the publish times.

Service Interface

  • File in vehicle_interfaces/srv/QosReq.srv
# Get topic_name QoS setting
string topic_name

# Device type corresponds to vehicle_interfaces header DEVTYPE_XXX definitions (preserve)
uint8 dev_type

---
# response is true if value accepted, otherwise server ignore the request and response false
bool response

# Unique ID describes current qos profile
uint64 qid

# Ref to enum rmw_qos_history_policy_t
int8 history

# Ref to size_t depth
int64 depth

# Ref to enum rmw_qos_reliability_policy_t
int8 reliability

# Ref to enum rmw_qos_durability_policy_t
int8 durability

# Ref to struct rmw_time_t deadline
float64 deadline_ms

# Ref to struct rmw_time_t lifespan
float64 lifespan_ms

# Ref to enum rmw_qos_liveliness_policy_t
int8 liveliness

# Ref to struct rmw_time_t liveliness_lease_duration
float64 liveliness_lease_duration_ms

Topic Interface

  • File in vehicle_interfaces/msg/QosUpdate.msg
vehicle_interfaces/Header header
uint64 qid
string[] topic_table

Rclcpp QoS Members (Additional)

  • QoS Profile
/*
 * QoS definition in rclcpp/qos.hpp
 * QoS private member: rmw_qos_profile_t (rmw/types.h)
 * */

typedef struct rmw_qos_profile_t
{
    enum rmw_qos_history_policy_t history;
    size_t depth;
    enum rmw_qos_reliability_policy_t reliability;
    enum rmw_qos_durability_policy_t durability;
    struct rmw_time_t deadline;
    struct rmw_time_t lifespan;
    enum rmw_qos_liveliness_policy_t liveliness;
    struct rmw_time_t liveliness_lease_duration;


    bool avoid_ros_namespace_conventions;
} rmw_qos_profile_t;
  • Enumerators in QoS Profile
enum rmw_qos_history_policy_t
{
    RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT,
    RMW_QOS_POLICY_HISTORY_KEEP_LAST,
    RMW_QOS_POLICY_HISTORY_KEEP_ALL,
    RMW_QOS_POLICY_HISTORY_UNKNOWN
};

enum rmw_qos_reliability_policy_t
{
    RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,
    RMW_QOS_POLICY_RELIABILITY_RELIABLE,
    RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
    RMW_QOS_POLICY_RELIABILITY_UNKNOWN
};

enum rmw_qos_durability_policy_t
{
    RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,
    RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
    RMW_QOS_POLICY_DURABILITY_VOLATILE,
    RMW_QOS_POLICY_DURABILITY_UNKNOWN
};

enum rmw_qos_liveliness_policy_t
{
    RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT = 0,
    RMW_QOS_POLICY_LIVELINESS_AUTOMATIC = 1,
    RMW_DECLARE_DEPRECATED(
        RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE,
        RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE_DEPRECATED_MSG) = 2,
    // Using `3` for backwards compatibility.
    RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC = 3,
    RMW_QOS_POLICY_LIVELINESS_UNKNOWN = 4
};