rcS-posix: use ROS_DOMAIN_ID to set XRCE_DDS_DOM_ID

set XRCE_DDS_KEY to MAV_SYS_ID to avoid collisions

Signed-off-by: Beniamino Pozzan <beniamino.pozzan@phd.unipd.it>
This commit is contained in:
Beniamino Pozzan 2023-03-27 12:02:54 -07:00 committed by Daniel Agar
parent a11cced4b2
commit 89a00f9505
1 changed files with 9 additions and 2 deletions

View File

@ -129,6 +129,7 @@ fi
# multi-instance setup
# shellcheck disable=SC2154
param set MAV_SYS_ID $((px4_instance+1))
param set XRCE_DDS_KEY $((px4_instance+1))
if [ $AUTOCNF = yes ]
then
@ -268,8 +269,7 @@ navigator start
microdds_ns=""
if [ "$px4_instance" -ne "0" ]
then
# Assign new xrce dds key based on instance number and set default namespace
param set XRCE_DDS_KEY ${px4_instance}
# for multi intances setup, add namespace prefix
microdds_ns="-n px4_$px4_instance"
fi
if [ -n "$PX4_MICRODDS_NS" ]
@ -277,6 +277,13 @@ then
# Override namespace if environment variable is defined
microdds_ns="-n $PX4_MICRODDS_NS"
fi
if [ -n "$ROS_DOMAIN_ID" ]
then
# Match XRCE_DDS_DOM_ID with ROS_DOMAIN_ID, if defined
param set XRCE_DDS_DOM_ID $ROS_DOMAIN_ID
else
param set XRCE_DDS_DOM_ID 0
fi
microdds_client start -t udp -h 127.0.0.1 -p 8888 $microdds_ns
if param greater -s MNT_MODE_IN -1