forked from Archive/PX4-Autopilot
microRTPS: rename uorb_to_ros_rtps_ids to uorb_to_ros_urtps_topics and remove the 'id' references on it
This commit is contained in:
parent
4609949bbb
commit
a8a56a03a4
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script to read an yaml file containing the RTPS message IDs and update the naming convention to PascalCase
|
||||
Script to read an yaml file containing the microRTPS topics and update the naming convention to PascalCase
|
||||
"""
|
||||
|
||||
import errno
|
||||
|
@ -69,7 +69,7 @@ def load_yaml_file(file):
|
|||
Open yaml file and parse the data into a list of dict
|
||||
|
||||
:param file: the yaml file to load
|
||||
:returns: the list of dictionaries that represent the message and respective RTPS IDs
|
||||
:returns: the list of dictionaries that represent the topics to send and receive
|
||||
:raises IOError: raises and error when the file is not found
|
||||
"""
|
||||
try:
|
||||
|
@ -105,9 +105,6 @@ def update_yaml_file(list, file):
|
|||
"""
|
||||
Open the yaml file to dump the new list of dict toself.
|
||||
|
||||
.. note:: Since the the dump method automatically sorts the keys alphabetically,
|
||||
the 'id' fields will appear first than the 'msg' fields.
|
||||
|
||||
:param list: the list of updated dicts
|
||||
:param file: the yaml file to load and write the new data
|
||||
:raises IOError: raises and error when the file is not found
|
||||
|
@ -115,9 +112,9 @@ def update_yaml_file(list, file):
|
|||
try:
|
||||
with open(file, 'w') as f:
|
||||
f.write("# AUTOGENERATED-FILE! DO NOT MODIFY IT DIRECTLY.\n#"
|
||||
" Edit instead the same file under PX4-Autopilot/msg/tools and"
|
||||
" use the \n# PX4-Autopilot/msg/tools/uorb_to_ros_rtps_ids.py"
|
||||
" to regenerate this file.\n")
|
||||
" Edit instead the same file under PX4-Autopilot/msg/tools and"
|
||||
" use the \n# PX4-Autopilot/msg/tools/uorb_to_ros_urtps_topics.py"
|
||||
" to regenerate this file.\n")
|
||||
yaml.dump(list, f, Dumper=IndenterDumper, default_flow_style=False)
|
||||
if verbose:
|
||||
if in_file == out_file:
|
||||
|
@ -134,7 +131,7 @@ def update_yaml_file(list, file):
|
|||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Read an yaml file containing the RTPS message IDs and update the naming convention to PascalCase')
|
||||
description='Read an yaml file containing the microRTPS topics and update the naming convention to PascalCase')
|
||||
optional = parser._action_groups.pop()
|
||||
required = parser.add_argument_group('Required')
|
||||
required.add_argument("-i", "--input-file", dest="input_file",
|
||||
|
@ -152,7 +149,7 @@ if __name__ == "__main__":
|
|||
args.output_file != in_file and args.output_file != "") else in_file
|
||||
|
||||
if verbose:
|
||||
print("-- PX4 to ROS RTPS Ids --")
|
||||
print("-- PX4 to ROS topics --")
|
||||
|
||||
list = load_yaml_file(in_file)
|
||||
update_dict(list)
|
Loading…
Reference in New Issue