DeclareLaunchConfiguration: How do I set a parameter to be of integer type?

asked 2022-08-10 16:02:11 -0500

kungaloosh64 gravatar image

I'm trying to pass an argument of integer type: launch.actions.DeclareLaunchArgument('s_port', default_value=1117)

However, when I try to launch this file with --show-args, it fails with the following error: Caught exception when trying to load file of format [py]: 'int' object is not iterable

Casting the final output to integer like so: {'server_port': int(launch.substitutions.LaunchConfiguration('s_port'))} shows this error: Caught exception when trying to load file of format [py]: int() argument must be a string, a bytes-like object or a real number, not 'LaunchConfiguration'

How do I define the expected type of the launch argument? I'm used to using argparse in python where I can fix the type of each argument while adding it to my parser.

Thanks!

edit retag flag offensive close merge delete