Rosanswers logo

I have been following the following tutorial : "urdf/Tutorials/Using urdf with robot_state_publisher", but when I run "roslaunch r2d2 r2d2.launch", I have the following error: "cannot locate node of type [r2d2/state_publisher]".

I have to admit that I overlooked the statement "(throughout this example, we assume package name "r2d2" and node name "state_publisher")", so I have no file corresponding to a state_publisher. What's the solution?

Originally posted by Flavian on ROS Answers with karma: 112 on 2013-07-31

Post score: 0


1 Answer 1


Rosanswers logo

You need to have a look at the launch file xml format for node. The line

<node name="state_publisher" pkg="r2d2" type="state_publisher" />

is likely your problem. Change type="state_publisher" to type="<insert your executable name here>"

Originally posted by thebyohazard with karma: 3562 on 2013-08-01

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by Carrie Yan on 2017-06-06:
I use .cpp to write my state_publisher and I change the type="" to type = "state_publisher.cpp" in my launch file, but it still reports ERROR: cannot launch node of type [r2d2/state_publisher.cpp]: can't locate node [state_publisher.cpp] in package [r2d2]

Please help. Thanks

Comment by thebyohazard on 2018-10-10:
I'm just seeing your message. In the future, you should ask a new question and link to related questions in your question to get better help. Usually a file with a .cpp extension contains code and a binary will not have an extension. Use whatever the add_executable argument is in your CMakeLists.txt


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.