9#if defined(CARLA_ROS2_MIDDLEWARE_ZENOH) || defined(CARLA_ROS2_MIDDLEWARE_TESTING)
25constexpr const char* kZenohNodeId =
"0";
26constexpr const char* kZenohNodeName =
"carla_bridge";
27constexpr const char* kZenohEntityKindPub =
"MP";
28constexpr const char* kZenohEntityKindSub =
"MS";
29constexpr const char* kZenohEntityKindNode =
"NN";
30constexpr const char* kZenohDefaultQos =
"::,1:,:,:,,";
47inline std::string zenoh_qos_keyexpr(
const QosProfile& qos) {
54 return std::string(rel) +
":" + dur +
":" + hist +
"," +
55 std::to_string(qos.history_depth) +
":,:,:,,";
60inline uint64_t zenoh_next_entity_id() {
61 static std::atomic<uint64_t> counter{0};
62 return counter.fetch_add(1, std::memory_order_relaxed);
70inline std::string zenoh_ros_domain_id() {
76inline std::string zenoh_strip_rt_prefix(
const std::string& topic) {
77 return topic.compare(0, 3,
"rt/") == 0 ? topic.substr(3) : topic;
82inline std::string zenoh_mangle_topic(
const std::string& topic) {
84 out.reserve(topic.size() + 1u);
86 for (
char c : topic) out.push_back(c ==
'/' ?
'%' : c);
92inline std::string zenoh_make_topic_keyexpr(
93 const std::string& domain,
94 const std::string& topic_no_rt,
95 const char* type_name,
96 [[maybe_unused]]
const char* type_hash)
98 return domain +
"/" + topic_no_rt +
"/" + type_name +
"/*";
103inline std::string zenoh_make_node_liveliness_keyexpr(
104 const std::string& domain,
105 const std::string& zid)
107 return std::string(
"@ros2_lv/") + domain +
"/" + zid +
"/" + kZenohNodeId +
108 "/" + kZenohNodeId +
"/" + kZenohEntityKindNode +
"/%/%/" +
115inline std::string zenoh_make_topic_liveliness_keyexpr(
116 const std::string& domain,
117 const std::string& zid,
119 const char* entity_kind,
120 const std::string& topic_no_rt,
121 const char* type_name,
122 const char* type_hash,
125 return std::string(
"@ros2_lv/") + domain +
"/" + zid +
"/" + kZenohNodeId +
126 "/" + std::to_string(eid) +
"/" + entity_kind +
"/%/%/" +
127 kZenohNodeName +
"/" + zenoh_mangle_topic(topic_no_rt) +
"/" +
128 type_name +
"/" + type_hash +
"/" + qos;
134inline std::vector<uint8_t> zenoh_attachment() {
136 1, 0, 0, 0, 0, 0, 0, 0,
137 0, 0, 0, 0, 0, 0, 0, 0,
139 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB,
140 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB,
static int GetEffectiveDomainId()
This file contains definitions of common data structures used in traffic manager.