I had an error in the 3th unit in excercie 2.5 : I am supposed to create a launch file that launches the map_server node:
The package that i am going to create won’t contain any source code file , so I didn’t know what the argument type should include!
I thought that the launch file would look like that , but I got an error:
<launch> <node pkg="provide_map" name="my_map_name" output="screen"> </node> </launch>
Can you show your launch file?
And did you already create your map?
I have already created and saved the map . Its name is ‘my_map_name’
And there is my launch file ,I have just edited the post.
If you already created the map, you have to add the path of the map to your launchfile as an argument
You can use the $(find mypackage) command too, so like args=“$(find mypackage)/map/my_map.yaml”
1 Like
Did you created there a py or cpp src code file in that package ? Because the excercie didn’t mention that and I didn’t even include a type attribute as you see above and I still get an error : attrivbute missing. Should I create a src code file? If yes what should be there?
Hi @mouidsakka01 ,
It goes by default that if the type
in launch file does not indicate a .py
extension, then the file type is a .cpp
.
So, to be clear, when you launch map_server node, you call map_server
package that contains the map_server
cpp file whose name is also map_server
. The argument you provide is the path to your map file that you have saved when you created your mappping.
Regards,
Girish
1 Like
I knew that the package map_server contained a cpp file. But why when I navigated there to check it up I couldn’t find it?
I mean aren’t the nodes map_server and map_saver are supposed to be found there in some source file? Idk maybe this has to do with cmake , which I still don’t know what it is.
Hi @mouidsakka01 ,
map_server provides the map_server ROS Node, which offers map data as a ROS Service. It also provides the map_saver command-line utility, which allows dynamically generated maps to be saved to file.
Source: https://wiki.ros.org/map_server
map_server node source: navigation/map_server/src/main.cpp at noetic-devel · ros-planning/navigation · GitHub
That is because you are looking in the wrong directory.
user:~$ cd /opt/ros/noetic/lib/map_server/
user:/opt/ros/noetic/lib/map_server$ ls -la
total 272
drwxr-xr-x 1 root root 4096 Sep 17 2021 .
drwxr-xr-x 1 root root 20480 Jan 12 2022 ..
-rwxr-xr-x 1 root root 3942 Aug 27 2020 crop_map
-rwxr-xr-x 1 root root 88544 Jul 27 2021 map_saver
-rwxr-xr-x 1 root root 158344 Jul 27 2021 map_server <--- executable!
user:/opt/ros/noetic/lib/map_server$
System framework packages will always be in a secured location. It won’t be in open-access location like the path of roscd map_server
so that people won’t mess around with important original files!
Regards,
Girish
1 Like