Exercise 2.5 in ROS Navigation

Hello there,
I’m trying to solve exercise 2.5

I had no idea what to put for type and name in .launch file. I saw the forum where the pkg type and name were all given the same arguments. So I did the same.

It still threw the following error

Would you help me understand:

  1. Why does it throw error and what’s the solution ?
  2. Why do we give the pkg="map_server" when our launch file is in provide_map package
  3. why do we give type="map_server". What does it mean to have written it that way or what would it actually do ? I thought we might need to write some python code and write that as our type.

Hello @abdulbasitisdost,

I think you should have a look at the ROS Basics course before going for more advanced courses since it will provide you a basic understanding of these basic concepts, like how launch files work.

Summarizing:

  • pkg contains the name of the package which contains the program (ROS node) you want to start.
  • type contains the name of the program (executable node in this case) that you want to start.

So, here you are launching a ROS program (executable node) named map_server from a ROS package which is also named map_server.

The error you are showing in the image is telling you that the program is looking for a map file named my_map.yaml in the path /home/user/src/catkin_ws/ and that the file is not there. So probably you will need to correctly set the path where this map file is located.

Best,

Thank you Professor Alberto @albertoezquerro And by the way, I’ve completed the ROS Basics.
It’s just that I thought you’ve to give the pkg name where as the name of the package where the launch file is. Similarly I thought that the type should be some python program which is in that package.
Just a small doubt; Here type is map_server, So Is this a python code that’s already written in map_server package ? If yes, then I think I had read in the ROS Basics course that it’s not a good practice to have the package and python file both having the same name. Would you please correct me if I’ve misunderstood something ?

Hello @abdulbasitisdost,

The pkg attribute contains the name of the package where the ROS program you want to start is located. It can be in the same package of the launch file, but you can also start a program from a different package (in fact, this is very common in ROS).

No, map_server here is a C++ executable (the equivalent to a Python script but in C++). This is why the .py extension is not there. You might want to check some Units of the ROS Basics in C++ course in order to better understand this idea.

Best,

1 Like

Sure Professor Alberto @albertoezquerro
I’ll try to complete ROS Basics in C++ too.
Thank you Prof