Map_server works zith rosrun but not in launch file

Greetings,

I’m currently working on the navigation in 5 day project. I’m at the final step of unit 1, creating a publisher for my map.
When I use

rosrun map_server map_server $HOME/catkin_ws/src/my_turtlebot_mapping/maps/map1.yaml

it works perfectly, but then when I try to use this launch file

<launch>
    <node pkg="map_server" type="map_server" name="Map_provider" output="screen" args="$HOME/catkin_ws/src/my_turtlebot_mapping/maps/map1.yaml">
    </node>
</launch>

with the command

roslaunch my_turtlebot_mapping map_provider.launch

It says me that :

ERROR] [1634740478.240541993]: Map_server could not open $HOME/catkin_ws/src/my_turtlebot_mapping/maps/map1.yaml.

It might be a typing error … but I’m lost now. may I ask if you have any idea ?

Many thanks

Hello @loickchovet ,

It looks like your launch file is not able to resolve the name $HOME. Try substituting it by the current path /home/user.

Best,

In addition to what @albertoezquerro mentioned, you can also try:

args="$(env HOME)/catkin_ws/src/my_turtlebot_mapping/maps/map1.yaml"

It works perfectly,

thanks for the information

1 Like