I have been doing the “ROS2 Basics in 5 Days (Python)” course, and in the topic 2.7 creating a launch file, i am not able to launch the launch file for “Exercise 3”
I have followed all the steps so far, and when i come to the part where i have to launch the file using the command “ros2 launch”, it is showing that the file does not exist.
i have attached a screenshot of the whole console displaying the editor, file tree and terminal
Please help, if you need further clarification, please message
Hi @Dhananjay_Panth, the error indicates that the two_rover_heartbeat.py file is not found in the share directory of the mars_rover_systems package. This typically happens due to a missing or incorrect configuration in the package’s setup.py. Can you share the setup.py? The problem must be there.
P:S: The “setuptools” library always throws up an error, as seen in the above pic, it always shows "Import “setuptools” could not be resolved from sourcePylance(reportMissingModuleSource)
" When i did this course back in june, i had the same problem then, and now also. Same problem, In the same exercise. i dont know whether it is my fault, or something else…
You named your file two_rover_heartbeat.py and in the setup.py you are saying that it is a .launch.py so all you have to do is rename your script to two_rover_heartbeat.launch.py which is the extension for launch files in ROS2.
It seems the changes were not applied successfully. Here’s how you can verify and fix this:
Navigate to the install/share/mars_rover_systems/launch folder to ensure that the file with the updated name is present. You can do this with:
ls ~/ros2_ws/install/share/mars_rover_systems/launch/
Here you should see your two_rover_heartbeat.launch.py, if the file is not listed, it means the changes in your setup.py were not applied during the build process and you have to compile and source again.
I found the error, in your folder tree you have the launch file inside the /mars_rover_systems/mars_rover_systems/launch and it should be /mars_rover_systems/launch, the launch folder must be at the same level as resource, test and mars_rover_systems folders as the notebook says. Make this correction and now I am sure that it will work.