Launch error for rosbasics

attempting to launch myfile for excercise 3.1 with the following:
~/catkin_ws$ roslaunch three_one launchfile.launch
Get this error
RLException: [launchfile.launch] is neither a launch file in package [three_one] nor is [three_one] a launch file name
The traceback for the exception was written to the log file

This is my formatting:
image

Please show the code from the launch file you are using, without that there is no way to tell what the problem might be. That error is caused by an invalid launch file sometimes it’s just a simple typo.

2 Likes
<!-- My Package launch file -->

<node pkg="three_one" type="3.1a.py" name="launchfilez"  output="screen">

</node>

Thanks!

You are missing the <launch> tags so you should have something like this:

<launch>

    <node pkg="three_one" type="3.1a.py" name="launchfilez" output="screen">

    </node>

</launch>

Tab in like you see above before starting your node tag. You may also want to consider renaming the python script so you don’t have the two periods. I would just go with something like this 3_1a.py it’s just a suggestion not the cause of your problem.

Tried from scratch so some of the file names are different. Tried wtih launch tags as below:

<node pkg="my_exer" type="mypython.py" name="move_robot_node" output="screen" />

Still same error

"

<node pkg="my_exer" type="mypython.py" name="move_robot_node" output="screen" />

"

for some reason the launch tag isnt showing up on my message board but it is in my code

OK, if the launch tags are in their. Looking closer at the first image the 3.1.py file is not in the src folder of the package and python scripts will be listed before the CMakeLists.txt and package.xml if there not in the src folder that will prevent the launch file from finding them. All you’re python files will list before those two files since they end with a .py which comes before the .txt and .xml extensions. Anytime you see a python file after those files then its not in the package src directory. Just drag them in their and it will find them.

Thank you
I did that and now the py file is definetly in the src folder and above teh other file types. However I get the same error

when I type
roscd my_ex
I get:
roscd: No such package/stack ‘my_ex’

could it be that my package is not being saved/formatted incorrectly?

After you create a new package if you want the system to fill it in for you use:
rospack profile this will update the system so it will know you have a new package. You will learn this later. If you had typed the full package name followed by the launch file it should work.

1 Like

did rospack profile
*package name = my_attempt

Still get the following error:
user:~/catkin_ws/src$ roscd my_attempt

roscd: No such package/stack ‘my_attempt’

You don’t want to be in the catkin_ws/src folder anymore just the catkin_ws folder that’s why it’s not working. From now on you should only be in the catkin_ws folder unless instructed otherwise. The only time you need to be in the catkin_ws/src folder is when you create a new package from their you use the src folder in the package directory this is how you organize all your files if everything went into the catkin_ws/src directory their would be no reason for creating packages and when you start working on large projects you need to have your files organized. When you get to a course project or exam you will find that you need dozens of files and a large project might contain hundreds of files or more. Also make sure you create your launch directory and any other directories associated with that package in the package directory and place your python files in the package src folder or in some cases a script folder if a project contains both code that require catkin_make such as C++ and python files then a scripts folder in often used for the python files .

i am trying to start from scratch and redoing unit 2 but am stilll getting errors

Everything looks correct that is how your packages should be organized. Run these three commands catkin_make, rospack profile, source devel/setup.bash right after each one finishes. Then roscd test TAB-TAB to see if it fills in the rest for you if it still doesn’t work see if will work with one of the other package directories and also see if you can just cd into the directory. Just run the catkin_make once and it is also is not generally required for rospack profile to work, but it can help when the problem is unusually stubborn like this. Also if you’re not already familiar with this roscd; cd .. will take you back to the catkin_ws from any package directory and any of it’s sub directories such as launch or src. It really doesn’t matter how deep you are in the subdirectories it will always take you back to catkin_ws

The first part did not work. Got the same error:

RLException: [lf.launch] is neither a launch file in package [testpkg]nor is [testpkg] a launch file name
The traceback for the exception was written to the log file

I did the second part, I basically put the programming code into a previous working package and ran it. Then it worked! There must be something wrong with how im creating the package or launch file?

What am I doing wrong?

The only thing different than your directions is that I use catkin build instead of catkin make

I have sent a message to a moderator. He has more experience with catkin build I only recently started looking into catkin build. It is a more advanced tool but I have so many packages built with catkin_make and switching requires a migration process. So if you have ever mixed the two commands that would create a problem, and the problem probably does reside in your build space not with your launch files this is why I’m asking someone else with more experience to provide you with help. I will check in on this post to see if he has responded. It’s time I start to learn much more about catkin build. It is becoming much more common. I need to be able to provide support regardless of the build command used.

2 Likes

I am getting similar errors as I try to make new packages and launch new programs. Can you please advise? I cannot just keep placing them in an already working folder

this is my launch fild syntax:

*<*launch>

<node pkg="apublisherpkg" type="publish2cmdvel.py" name="noding

" output="screen" />

 <node pkg="apublisherpkg" type="publish2cmdvel.py" name="noding2

" output="screen" />

</launch>

I added asterik to " otherwise it wont show for some reason

I redid the entire excercise and think that I have it recognizing the package. Must have forgotten something the first time and not caught it. now im getting the following error:

RLException: Roslaunch got a ‘No such file or directory’ error while attempting to run:

/home/user/catkin_ws/src/my_package/src/notsosimple.py __name:=noding __log:=/home/user/.ros/log/fc173726-9c96-11eb-9037-0242c0a8d008/noding-1.log

Please make sure that all the executables in this command exist and have
executable permission. This is often caused by a bad launch-prefix.
The traceback for the exception was written to the log file

Im going to send a screenshot of my launch file and my script. I dont know why its saying that about a possible bad launch file. My launch file has two notes- could that be a problem?