diff --git a/webots_ros2/CHANGELOG.rst b/webots_ros2/CHANGELOG.rst index 440fde748..74b3bec40 100644 --- a/webots_ros2/CHANGELOG.rst +++ b/webots_ros2/CHANGELOG.rst @@ -6,6 +6,7 @@ Changelog for package webots_ros2 ------------------ * Added support for painted point clouds. * Fixed ability to launch RViz without other tools in e-puck example. +* Fixed command line arguments in importer tools. * Added new TIAGo project to webots_ros2_tiago to run real robot configuration. 2023.0.3 (2023-04-12) diff --git a/webots_ros2_importer/CHANGELOG.rst b/webots_ros2_importer/CHANGELOG.rst index b0a18601e..991845a93 100644 --- a/webots_ros2_importer/CHANGELOG.rst +++ b/webots_ros2_importer/CHANGELOG.rst @@ -2,6 +2,10 @@ Changelog for package webots_ros2_importer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2023.0.4 (2023-XX-XX) +------------------ +* Fixed argument parsing + 2022.1.4 (2022-11-18) ------------------ * Upgraded to urdf2webots 2.0.3 diff --git a/webots_ros2_importer/webots_ros2_importer/urdf2proto.py b/webots_ros2_importer/webots_ros2_importer/urdf2proto.py index bbd7c4c7d..bf9bbdaac 100644 --- a/webots_ros2_importer/webots_ros2_importer/urdf2proto.py +++ b/webots_ros2_importer/webots_ros2_importer/urdf2proto.py @@ -24,7 +24,7 @@ def main(args=None, urdfInput=None): - parser = argparse.ArgumentParser(usage='usage: %prog --input=my_robot.urdf [options]') + parser = argparse.ArgumentParser(usage='usage: %(prog)s --input=my_robot.urdf [options]') parser.add_argument('--input', dest='input', default='', help='Specifies the URDF file.') parser.add_argument('--output', dest='output', default='', help='Specifies the path and, if ending in ".proto", name ' 'of the resulting PROTO file. The filename minus the .proto extension will be the robot name ' @@ -53,13 +53,13 @@ def main(args=None, urdfInput=None): # use 'parse_known_args' because ROS2 adds a lot of internal arguments arguments, _ = parser.parse_known_args() file = os.path.abspath(urdfInput) if urdfInput is not None else os.path.abspath(arguments.input) - if not arguments.input: + if not file: sys.exit('Input file not specified (should be specified with the "--input" argument).') if not os.path.isfile(file): - sys.exit('"%s" file does not exist.' % arguments.input) + sys.exit('"%s" file does not exist.' % file) elif not file.endswith('.urdf'): sys.exit('"%s" is not an urdf file.' % file) - convertUrdfFile(input=arguments.input, + convertUrdfFile(input=file, output=arguments.output, normal=arguments.normal, boxCollision=arguments.boxCollision, diff --git a/webots_ros2_importer/webots_ros2_importer/xacro2proto.py b/webots_ros2_importer/webots_ros2_importer/xacro2proto.py index 938af4175..ddb72f0d9 100644 --- a/webots_ros2_importer/webots_ros2_importer/xacro2proto.py +++ b/webots_ros2_importer/webots_ros2_importer/xacro2proto.py @@ -24,7 +24,7 @@ def main(args=None): - parser = argparse.ArgumentParser(usage='usage: %prog --input=my_robot.urdf.xacro [options]') + parser = argparse.ArgumentParser(usage='usage: %(prog)s --input=my_robot.urdf.xacro [options]') parser.add_argument('--input', dest='inFile', default=None, help='Specifies the xacro file to convert.') parser.add_argument('--xacro-opts', dest='xacro_opts', default=None, @@ -82,7 +82,7 @@ def main(args=None): # restore stdout and arguments and then run urdf to proto conversion sys.stdout = orig_stdout sys.argv = saved_argv - urdf2proto.main(input=path) + urdf2proto.main(urdfInput=path) os.remove(path)