Add namespace support for uxrce-dds client during firmware upload (#25291)

This commit is contained in:
E-Krantz
2025-07-25 11:43:30 -08:00
committed by GitHub
parent 200be07021
commit 600c717eb9
@@ -79,10 +79,16 @@ if not os.path.exists(folder_name):
with open(args.yaml_file, 'r') as file:
msg_map = yaml.safe_load(file)
# Get DDS namespace from environment, default to empty string
namespace = os.getenv('PX4_UXRCE_DDS_NS', '')
merged_em_globals = {}
all_type_includes = []
def process_message_type(msg_type):
# Add namespace to topic
msg_type['topic'] = f"/{namespace}{msg_type['topic']}" if namespace else msg_type['topic']
# eg TrajectoryWaypoint from px4_msgs::msg::TrajectoryWaypoint
simple_base_type = msg_type['type'].split('::')[-1]
@@ -96,6 +102,8 @@ def process_message_type(msg_type):
# topic_simple: eg vehicle_status
msg_type['topic_simple'] = msg_type['topic'].split('/')[-1]
merged_em_globals['namespace'] = namespace
pubs_not_empty = msg_map['publications'] is not None
if pubs_not_empty:
for p in msg_map['publications']: