mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
microdds_client: add namespace to partecipant name
The partecipant name is modified into "client_namespace"/px4_micro_xrce_dds For sitl builds the microdds_client is automatically started with namespace px4_"instance_number" and udp port 8888+"intance_number" Signed-off-by: Beniamino Pozzan <beniamino.pozzan@phd.unipd.it>
This commit is contained in:
committed by
Daniel Agar
parent
8eb2a0a3ec
commit
a92897fb58
@@ -260,7 +260,7 @@ fi
|
|||||||
navigator start
|
navigator start
|
||||||
|
|
||||||
# Try to start the microdds_client with UDP transport if module exists
|
# 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
|
if param greater -s MNT_MODE_IN -1
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -53,6 +53,8 @@
|
|||||||
#define STREAM_HISTORY 4
|
#define STREAM_HISTORY 4
|
||||||
#define BUFFER_SIZE (UXR_CONFIG_SERIAL_TRANSPORT_MTU * STREAM_HISTORY) // MTU==512 by default
|
#define BUFFER_SIZE (UXR_CONFIG_SERIAL_TRANSPORT_MTU * STREAM_HISTORY) // MTU==512 by default
|
||||||
|
|
||||||
|
#define PARTICIPANT_XML_SIZE 512
|
||||||
|
|
||||||
using namespace time_literals;
|
using namespace time_literals;
|
||||||
|
|
||||||
void on_time(uxrSession *session, int64_t current_time, int64_t received_timestamp, int64_t transmit_timestamp,
|
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,
|
// uint16_t participant_req = uxr_buffer_create_participant_bin(&session, reliable_out, participant_id, domain_id,
|
||||||
// participant_name, UXR_REPLACE);
|
// participant_name, UXR_REPLACE);
|
||||||
|
|
||||||
// TODO: configurable participant name with client namespace?
|
char participant_xml[PARTICIPANT_XML_SIZE];
|
||||||
const char *participant_xml = _localhost_only ?
|
int ret = snprintf(participant_xml, PARTICIPANT_XML_SIZE, "%s<name>%s/px4_micro_xrce_dds</name>%s",
|
||||||
"<dds>"
|
_localhost_only ?
|
||||||
"<profiles>"
|
"<dds>"
|
||||||
"<transport_descriptors>"
|
"<profiles>"
|
||||||
"<transport_descriptor>"
|
"<transport_descriptors>"
|
||||||
"<transport_id>udp_localhost</transport_id>"
|
"<transport_descriptor>"
|
||||||
"<type>UDPv4</type>"
|
"<transport_id>udp_localhost</transport_id>"
|
||||||
"<interfaceWhiteList><address>127.0.0.1</address></interfaceWhiteList>"
|
"<type>UDPv4</type>"
|
||||||
"</transport_descriptor>"
|
"<interfaceWhiteList><address>127.0.0.1</address></interfaceWhiteList>"
|
||||||
"</transport_descriptors>"
|
"</transport_descriptor>"
|
||||||
"</profiles>"
|
"</transport_descriptors>"
|
||||||
"<participant>"
|
"</profiles>"
|
||||||
"<rtps>"
|
"<participant>"
|
||||||
"<name>px4_micro_xrce_dds</name>"
|
"<rtps>"
|
||||||
"<useBuiltinTransports>false</useBuiltinTransports>"
|
:
|
||||||
"<userTransports><transport_id>udp_localhost</transport_id></userTransports>"
|
"<dds>"
|
||||||
"</rtps>"
|
"<participant>"
|
||||||
"</participant>"
|
"<rtps>",
|
||||||
"</dds>"
|
_client_namespace != nullptr ?
|
||||||
:
|
_client_namespace
|
||||||
"<dds>"
|
:
|
||||||
"<participant>"
|
"",
|
||||||
"<rtps>"
|
_localhost_only ?
|
||||||
"<name>px4_micro_xrce_dds</name>"
|
"<useBuiltinTransports>false</useBuiltinTransports>"
|
||||||
"</rtps>"
|
"<userTransports><transport_id>udp_localhost</transport_id></userTransports>"
|
||||||
"</participant>"
|
"</rtps>"
|
||||||
"</dds>" ;
|
"</participant>"
|
||||||
|
"</dds>"
|
||||||
|
:
|
||||||
|
"</rtps>"
|
||||||
|
"</participant>"
|
||||||
|
"</dds>"
|
||||||
|
);
|
||||||
|
|
||||||
|
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,
|
uint16_t participant_req = uxr_buffer_create_participant_xml(&session, reliable_out, participant_id, domain_id,
|
||||||
participant_xml, UXR_REPLACE);
|
participant_xml, UXR_REPLACE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user