From 5919ef69cbb948ee01d3669b648d039afd68692d Mon Sep 17 00:00:00 2001 From: Rhys Mainwaring Date: Tue, 4 Jun 2024 18:22:20 +0100 Subject: [PATCH] AP_DDS: add param DDS_DOMAIN_ID - Require reboot. - Set DDS_DOMAIN_ID range: 0 to 232.. Signed-off-by: Rhys Mainwaring --- libraries/AP_DDS/AP_DDS_Client.cpp | 11 +++++++++-- libraries/AP_DDS/AP_DDS_Client.h | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libraries/AP_DDS/AP_DDS_Client.cpp b/libraries/AP_DDS/AP_DDS_Client.cpp index 76df6f2bca508..eb54a54eff09f 100644 --- a/libraries/AP_DDS/AP_DDS_Client.cpp +++ b/libraries/AP_DDS/AP_DDS_Client.cpp @@ -74,6 +74,14 @@ const AP_Param::GroupInfo AP_DDS_Client::var_info[] { #endif + // @Param: _DOMAIN_ID + // @DisplayName: DDS DOMAIN ID + // @Description: Set the ROS_DOMAIN_ID + // @Range: 0 232 + // @RebootRequired: True + // @User: Standard + AP_GROUPINFO("_DOMAIN_ID", 4, AP_DDS_Client, domain_id, 0), + AP_GROUPEND }; @@ -819,9 +827,8 @@ bool AP_DDS_Client::create() .type = UXR_PARTICIPANT_ID }; const char* participant_name = "ardupilot_dds"; - const uint16_t domain_id = 0; const auto participant_req_id = uxr_buffer_create_participant_bin(&session, reliable_out, participant_id, - domain_id, participant_name, UXR_REPLACE); + static_cast(domain_id), participant_name, UXR_REPLACE); //Participant requests constexpr uint8_t nRequestsParticipant = 1; diff --git a/libraries/AP_DDS/AP_DDS_Client.h b/libraries/AP_DDS/AP_DDS_Client.h index e796b78edb3fd..ac11e53e572aa 100644 --- a/libraries/AP_DDS/AP_DDS_Client.h +++ b/libraries/AP_DDS/AP_DDS_Client.h @@ -213,6 +213,9 @@ class AP_DDS_Client //! @brief Parameter storage static const struct AP_Param::GroupInfo var_info[]; + //! @brief ROS_DOMAIN_ID + AP_Int32 domain_id; + //! @brief Enum used to mark a topic as a data reader or writer enum class Topic_rw : uint8_t { DataReader = 0,