mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-15 13:00:36 +08:00
zenoh: Add support for ROS2 Humble and earlier (#26619)
* Add support for hash-less Zenoh topic key expressions - Add kConfig option ZENOH_KEY_TYPE_HASH to toggle the inclusion - Update topic and liveliness generators * chore: Update Zenoh kConfig param description and help message * docs(zenoh): Document Zenoh configuration for Humble * docs: Clarify PX4 ROS2 Interface library compatibility
This commit is contained in:
committed by
GitHub
parent
c5d22f5fea
commit
de9698e7fa
@@ -115,6 +115,8 @@ int ZENOH::generate_rmw_zenoh_topic_keyexpr(const char *topic, const uint8_t *ri
|
||||
if (type_name) {
|
||||
strncpy(type, type_name, TOPIC_INFO_SIZE);
|
||||
toCamelCase(type); // Convert uORB type to camel case
|
||||
|
||||
#ifdef CONFIG_ZENOH_KEY_TYPE_HASH
|
||||
return snprintf(keyexpr, KEYEXPR_SIZE, "%" PRId32 "%s/"
|
||||
KEYEXPR_MSG_NAME "%s_/RIHS01_"
|
||||
"%02x%02x%02x%02x%02x%02x%02x%02x"
|
||||
@@ -131,6 +133,11 @@ int ZENOH::generate_rmw_zenoh_topic_keyexpr(const char *topic, const uint8_t *ri
|
||||
rihs_hash[24], rihs_hash[25], rihs_hash[26], rihs_hash[27],
|
||||
rihs_hash[28], rihs_hash[29], rihs_hash[30], rihs_hash[31]
|
||||
);
|
||||
#else
|
||||
return snprintf(keyexpr, KEYEXPR_SIZE, "%" PRId32 "%s/"
|
||||
KEYEXPR_MSG_NAME "%s_/TypeHashNotSupported",
|
||||
_zenoh_domain_id.get(), topic, type);
|
||||
#endif
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -155,6 +162,7 @@ int ZENOH::generate_rmw_zenoh_topic_liveliness_keyexpr(const z_id_t *id, const c
|
||||
str++;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ZENOH_KEY_TYPE_HASH
|
||||
return snprintf(keyexpr, KEYEXPR_SIZE,
|
||||
"@ros2_lv/%" PRId32 "/"
|
||||
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x/"
|
||||
@@ -184,6 +192,25 @@ int ZENOH::generate_rmw_zenoh_topic_liveliness_keyexpr(const z_id_t *id, const c
|
||||
rihs_hash[24], rihs_hash[25], rihs_hash[26], rihs_hash[27],
|
||||
rihs_hash[28], rihs_hash[29], rihs_hash[30], rihs_hash[31]
|
||||
);
|
||||
#else
|
||||
return snprintf(keyexpr, KEYEXPR_SIZE,
|
||||
"@ros2_lv/%" PRId32 "/"
|
||||
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x/"
|
||||
"0/11/%s/%%/%%/px4_%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x/%s/"
|
||||
KEYEXPR_MSG_NAME "%s_/TypeHashNotSupported"
|
||||
"/::,7:,:,:,,",
|
||||
_zenoh_domain_id.get(),
|
||||
id->id[0], id->id[1], id->id[2], id->id[3], id->id[4], id->id[5], id->id[6],
|
||||
id->id[7], id->id[8], id->id[9], id->id[10], id->id[11], id->id[12], id->id[13],
|
||||
id->id[14], id->id[15],
|
||||
entity_str,
|
||||
_px4_guid[0], _px4_guid[1], _px4_guid[2], _px4_guid[3],
|
||||
_px4_guid[4], _px4_guid[5], _px4_guid[6], _px4_guid[7],
|
||||
_px4_guid[8], _px4_guid[9], _px4_guid[10], _px4_guid[11],
|
||||
_px4_guid[12], _px4_guid[13], _px4_guid[14], _px4_guid[15],
|
||||
topic_lv, type_camel_case
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
int ZENOH::setupSession()
|
||||
|
||||
Reference in New Issue
Block a user