ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Cannot locate launch node of type + Can't locate node

asked 2014-08-04 13:57:58 -0500

gerhenz gravatar image

Hi,

I'm trying to create a node using this code in order to obtain the turtlebot coordinates in the map reference frame.

I've tried adding the node in an existing package, but I wasn't successful.

Therefore, I've created a new package (following this, this and this tutorials). In the last tutorial, instead of using the publisher and subscriber codes, I used the one I mentioned above.

I've used xy_pos as the package name and turtlebot_coordinates as the node name.

I'm able to use rosrun xy_pos turtlebot_coordinates, it works fine.

However, when I try to use the node via a launch file, I've got the following error:

ERROR: cannot launch node of type [xy_pos/turtlebot_coordinates.cpp]: can't locate node [turtlebot_coordinates.cpp] in package [xy_pos].

The part of the launch file related to this node is:

<node name="turtlebot_coordinates" pkg="xy_pos" type="turtlebot_coordinates.cpp" output="screen"> </node>

It's not a problem with ROS_PACKAGE_PATH ( roscd xy_pos works fine)

I've tried the solution for this question but it didn't work.

Does someone have any suggestion?

P.S: I don't know if this influences in something, but my launch file is inside an existing package. So while the new package is inside catkin/src/, the launch file is in a package inside opt/ros/hydro/share/. Is it a problem?

Thanks!

edit retag flag offensive close merge delete

Comments

hello, I have the same problem with you. Did you solve this problem? Could you tell me how?

dido_yf gravatar image dido_yf  ( 2014-12-18 04:31:06 -0500 )edit

Yes. Just remove the .cpp from the type argument as stated in ahendrix's answer below.

gerhenz gravatar image gerhenz  ( 2014-12-18 06:01:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2014-08-04 15:36:23 -0500

ahendrix gravatar image

updated 2014-08-04 15:36:35 -0500

The node name you use in roslaunch should be the executable name; not the source file name.

Try it without the .cpp:

<node name="turtlebot_coordinates" pkg="xy_pos" type="turtlebot_coordinates" output="screen">
</node>
edit flag offensive delete link more

Comments

I was getting confused because for nodes written in python you need to include the source file name in the launch file. I didn't know it was different for nodes written in C++. Thanks ahendrix!

gerhenz gravatar image gerhenz  ( 2014-08-05 03:09:32 -0500 )edit

Yeah I think its a bit confusing too :S

James Diprose gravatar image James Diprose  ( 2014-08-28 03:52:36 -0500 )edit
2

The way I remember it is that the pkg and type arguments to the node tag are the same arguments I use with rosrun.

ahendrix gravatar image ahendrix  ( 2014-08-29 12:33:51 -0500 )edit
1

hell yeahhh! pkg and type should be the same argument! 45 min. trying to figure out this shit man!!! :D

Farid gravatar image Farid  ( 2015-12-31 14:00:19 -0500 )edit

Don't forget that you are actually executing yourscript.py for python nodes and running the executable (which probably is a name) for cpp nodes.

OzzieTheHead gravatar image OzzieTheHead  ( 2018-02-21 13:28:01 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-08-04 13:57:58 -0500

Seen: 11,685 times

Last updated: Aug 04 '14