From 7c95e991568bcf5108d8136319bf4673238cb6e1 Mon Sep 17 00:00:00 2001 From: TSC21 Date: Mon, 11 Jan 2021 19:21:39 +0100 Subject: [PATCH] tools: make sure that uORB type names found as part of field names are not capitalized as ROS types --- msg/tools/uorb_to_ros_msgs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/msg/tools/uorb_to_ros_msgs.py b/msg/tools/uorb_to_ros_msgs.py index 2b3f1da683..66876dd7a6 100755 --- a/msg/tools/uorb_to_ros_msgs.py +++ b/msg/tools/uorb_to_ros_msgs.py @@ -5,6 +5,7 @@ Adapted from https://github.com/eProsima/px4_to_ros/blob/master/px4_to_ros2_PoC/ """ import os +import re import sys from shutil import copyfile @@ -90,7 +91,7 @@ for filename in os.listdir(output_dir): fileUpdated = True line = line.replace(('px4/' + msg_type), msg_type.partition(".")[0].title().replace('_', '')) - if ('' + msg_type + '[') in line.partition('#')[0] or ('' + msg_type + ' ') in line.partition('#')[0]: + if re.findall('^' + msg_type + '[\s\[]', line.partition('#')[0]): fileUpdated = True line = line.replace(msg_type, msg_type.partition(".")[0].title().replace('_', ''))