After looking this up myself, I found that you can pass parameters directly to the gtest file assuming in the main function you call rclcpp::init(&argc, argv)
. You can pass parameters like you would in ros2 run in the design documentation for parameters.
To load in a yaml file, you will then pass --ros-args --params-file /path/to/params.yaml
to the executable.
If you are using the python GTest class in launch_testing.actions.GTest
to launch your test, it only accepts a "path" which you could pass in the full command, or just use the Test
parent class directly and pass in the cmd
input.
You would end up with something like this as your command in python (for an example, I load in two param files):
cmd = test_path + ['--ros-args', '--params-file', '/path/to/params.yaml'] + ['--params-file', 'path/to/second_params_file.yaml' ]