Roslaunch can't locate node, but rosrun works fine
I'm working on a simple node written entirely in python. To make it work with roslaunch, I made it into a package. I got the package working fine, and I can run rosrun my_package controller
just fine. However, when I run it in a roslaunch file, it gives the error ERROR: cannot launch node of type [my_package/controller]: can't locate node [controller] in package [my_package]
What is wrong with my environment or package?
As a minimal example, I get this with the simple launch file:
<?xml version="1.0"?>
<launch>
<node pkg="my_package" type="controller" name="controller"/>
</launch>
What I've tried so far:
- Changing the name of the executable from "controller" to "controller.py" (And adjusting in the launch file)
- Setting 777 permissions on the executable
- Relaunching the terminal
source
ing .bashrc again (which has setup.bash in it)- Rerunning
catkin_make
a lot
The name of the file should not influence this at all. To verify, I just created a toy workspace with a single
rospy
pkg that contains acontroller
file containing the default Talker node. After building the workspace, bothrosrun
androslaunch
(after adding a launch file) can .... find the script and start it.
It is much more likely the OP has a typo somewhere, the file is not in the correct location, he forgot to
catkin_make
his workspace, he forgot tosource
the correctsetup.bash
(perhaps used a new terminal) or something else is not entirely correct.@gvdhoorn, I do have the setup.bash
source
'd in my bashrc. I also ran catkin_make repeatedly.This is probably not the solution, but do please realise that if you have
source .../setup.bash
in your.bashrc
, it will only actuallysource
your workspace if/when you open a new terminal, startbash
orsource $HOME/.bashrc
. It will not happen automatically whenever your .... workspace changes.
If you haven't
source
d after you built your workspace, then new pkgs added afterwards will not be picked up.@gcdhoorn I know, and I've both closed and reopened bash, and sourced bashrc again
then I believe we're going to need a little more info. Please tell us how you setup your workspace (paths, layout, etc), what your workflow is, show the contents of your pkg (
ls -al
), etc.I'll add that later today