How can we give arguments to the node in launch file?
I am using ros2 dashing and making a launch file including cam2image. For cam2image node, I can select the resolution using command line "ros2 run image_tools cam2image -x 1280 -y 960"
I want to do the same thing in the launch file because the default resoltion for cam2image is 320*240 which is too low.
I have no idea how to pass the arguments to the node in launch file properly. There is no example in the document. It always give me the default resolution when I run the following launch file.
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='image_tools',
node_executable='cam2image',
arguments=[{"width":1280, "height":960, "x":1280, "y":960}],
parameters=[{"width":1280, "height":960, "x":1280, "y":960}],
output='screen',
),
])