mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 05:53:35 +08:00
microdds_client: add XRCE_DDS_KEY parameter
Multiple agents can connect to the same client
For sitl builds, if the intance number is different from zero,
XRCE_DDS_KEY is set to the instance number and
the microdds_client is automatically started
with namespace
px4_"instance_number"
and udp port 8888
If the instance number is equal to zero
XRCE_DDS_KEY is left untouched and
the microdds_client is automatically started
without namespace
and udp port 8888
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@phd.unipd.it>
This commit is contained in:
committed by
Daniel Agar
parent
a92897fb58
commit
5a2e41c4e4
@@ -260,7 +260,13 @@ 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 "$((px4_instance+8888))" -n "px4_${px4_instance}"
|
if [ $px4_instance -eq 0 ]
|
||||||
|
then
|
||||||
|
microdds_client start -t udp -p 8888
|
||||||
|
else
|
||||||
|
param set XRCE_DDS_KEY ${px4_instance}
|
||||||
|
microdds_client start -t udp -p 8888 -n "px4_$px4_instance"
|
||||||
|
fi
|
||||||
|
|
||||||
if param greater -s MNT_MODE_IN -1
|
if param greater -s MNT_MODE_IN -1
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -184,7 +184,13 @@ void MicroddsClient::run()
|
|||||||
|
|
||||||
// Session
|
// Session
|
||||||
// The key identifier of the Client. All Clients connected to an Agent must have a different key.
|
// The key identifier of the Client. All Clients connected to an Agent must have a different key.
|
||||||
const uint32_t key = 0xAAAABBBB;
|
const uint32_t key = (uint32_t)_param_xrce_key.get();
|
||||||
|
|
||||||
|
if (key == 0) {
|
||||||
|
PX4_ERR("session key must be different from zero");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uxrSession session;
|
uxrSession session;
|
||||||
uxr_init_session(&session, _comm, key);
|
uxr_init_session(&session, _comm, key);
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ private:
|
|||||||
Timesync _timesync{};
|
Timesync _timesync{};
|
||||||
|
|
||||||
DEFINE_PARAMETERS(
|
DEFINE_PARAMETERS(
|
||||||
(ParamInt<px4::params::XRCE_DDS_DOM_ID>) _param_xrce_dds_dom_id
|
(ParamInt<px4::params::XRCE_DDS_DOM_ID>) _param_xrce_dds_dom_id,
|
||||||
|
(ParamInt<px4::params::XRCE_DDS_KEY>) _param_xrce_key
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,18 @@ parameters:
|
|||||||
reboot_required: true
|
reboot_required: true
|
||||||
default: 0
|
default: 0
|
||||||
|
|
||||||
|
XRCE_DDS_KEY:
|
||||||
|
description:
|
||||||
|
short: XRCE DDS key
|
||||||
|
long: |
|
||||||
|
XRCE DDS key, must be different from zero.
|
||||||
|
In a single agent - multi client configuration, each client
|
||||||
|
must have a unique session key.
|
||||||
|
category: System
|
||||||
|
type: int32
|
||||||
|
reboot_required: true
|
||||||
|
default: 1
|
||||||
|
|
||||||
XRCE_DDS_UDP_PRT:
|
XRCE_DDS_UDP_PRT:
|
||||||
description:
|
description:
|
||||||
short: Micro DDS UDP Port
|
short: Micro DDS UDP Port
|
||||||
|
|||||||
Reference in New Issue
Block a user