diff --git a/ROMFS/px4fmu_common/init.d-posix/rcS b/ROMFS/px4fmu_common/init.d-posix/rcS
index 4e6acb9c56..daccb7bbab 100644
--- a/ROMFS/px4fmu_common/init.d-posix/rcS
+++ b/ROMFS/px4fmu_common/init.d-posix/rcS
@@ -260,7 +260,7 @@ fi
navigator start
# Try to start the microdds_client with UDP transport if module exists
-microdds_client start -t udp -p 8888
+microdds_client start -t udp -p "$((px4_instance+8888))" -n "px4_${px4_instance}"
if param greater -s MNT_MODE_IN -1
then
diff --git a/src/modules/microdds_client/microdds_client.cpp b/src/modules/microdds_client/microdds_client.cpp
index 2e22d9c304..490d84af11 100644
--- a/src/modules/microdds_client/microdds_client.cpp
+++ b/src/modules/microdds_client/microdds_client.cpp
@@ -53,6 +53,8 @@
#define STREAM_HISTORY 4
#define BUFFER_SIZE (UXR_CONFIG_SERIAL_TRANSPORT_MTU * STREAM_HISTORY) // MTU==512 by default
+#define PARTICIPANT_XML_SIZE 512
+
using namespace time_literals;
void on_time(uxrSession *session, int64_t current_time, int64_t received_timestamp, int64_t transmit_timestamp,
@@ -222,34 +224,46 @@ void MicroddsClient::run()
// uint16_t participant_req = uxr_buffer_create_participant_bin(&session, reliable_out, participant_id, domain_id,
// participant_name, UXR_REPLACE);
- // TODO: configurable participant name with client namespace?
- const char *participant_xml = _localhost_only ?
- ""
- ""
- ""
- ""
- "udp_localhost"
- "UDPv4"
- "127.0.0.1"
- ""
- ""
- ""
- ""
- ""
- "px4_micro_xrce_dds"
- "false"
- "udp_localhost"
- ""
- ""
- ""
- :
- ""
- ""
- ""
- "px4_micro_xrce_dds"
- ""
- ""
- "" ;
+ char participant_xml[PARTICIPANT_XML_SIZE];
+ int ret = snprintf(participant_xml, PARTICIPANT_XML_SIZE, "%s%s/px4_micro_xrce_dds%s",
+ _localhost_only ?
+ ""
+ ""
+ ""
+ ""
+ "udp_localhost"
+ "UDPv4"
+ "127.0.0.1"
+ ""
+ ""
+ ""
+ ""
+ ""
+ :
+ ""
+ ""
+ "",
+ _client_namespace != nullptr ?
+ _client_namespace
+ :
+ "",
+ _localhost_only ?
+ "false"
+ "udp_localhost"
+ ""
+ ""
+ ""
+ :
+ ""
+ ""
+ ""
+ );
+
+ if (ret < 0 || ret >= TOPIC_NAME_SIZE) {
+ PX4_ERR("create entities failed: namespace too long");
+ return;
+ }
+
uint16_t participant_req = uxr_buffer_create_participant_xml(&session, reliable_out, participant_id, domain_id,
participant_xml, UXR_REPLACE);