Relative path doesnt work on yaml file with launch file
I want to load a map into the rosparam server. My yaml file looks like this:
image: "./office_right2_parking.pgm"
resolution: 0.050000
origin: [0.0, 0.0, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196
The pgm file is in the same folder. The relative path doesn't work, I know this because when I use the absolute path my programme runs smoothly. The yaml file gets "executed" from this launch file:
<?xml version="1.0"?>
<launch>
<arg name="map_yaml" default="$(find localization)/include/maps/office_right2_parking.yaml"/>
<rosparam command="load" file="$(arg map_yaml)" />
<node name="ppm_main" pkg="navigation" type="ppm_main" output="screen" />
</launch>
The launch file and the yaml file do not lay in the same directory.
Path of the yaml and map: src --> localization --> include --> maps
Path of the launch: src --> navigation --> launch
How can I make sure that the relative path works? The code will get executed on different computers, so absolute paths are not really the way to go. Changing the path of the launch file would be an option, but will be a lot of work to do and I havent looked into it.
I've read that relative paths reference to/from where you execute the launch file, but how can I make sure that every user makes the right decision in executing the launch file in the right place. This seems not very intuitive.
I hope you have any advice for me! Thanks in advance!