I'm stuck on Unit 3 creating a topic_publisher for a counter program

I think the issue is in my launch command. I followed the unit 2 to create a package called topic_publisher_pkg

Hi @richard.valenzuela-zavala191 ,

Welcome to this Community!

Could you please provide more info on your problem? What is happening? Are you having issues during compilation?

Please post the following as a code-block:

  1. Your terminal output (as text) showing the error.
  2. Your launch file.
  3. Your CMakeLists.txt file


Good Morning,

I seem to be having the same issue as @richard.valenzuela-zavala191 .

As he seems to not be answering the thread. I will give you my case. If my case happens to be not the same as his, I will move my question to a new topic with no problem.

Alright so following the Exercise 3.1 instructions, I created the following:

  • topic_publisher_pkg with deps roscpp and std_msgs

  • simple_topic_publisher code in which I copied the example code given.

  • Launch file with the following code:
    < launch>
    < !-- topic_pubisher launch file–>
    < node pkg=“topic_publisher” type=“simple_topic_publisher” name=“topic_publisher” output=“screen”>
    < /node>
    < /launch>

  • Modified CMakeLists.txt and added:
    add_executable(simple_topic_publisher src/simple_topic_publisher.cpp)
    add_dependencies(simple_topic_publisher ${simple_topic_publisher_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

  • The terminal output when launched:
    user:~/catkin_ws$ roslaunch topic_publisher_pkg topic_publisher_launch_file.launch
    … logging to /home/user/.ros/log/a0571150-efcc-11ed-aeda-0242ac160007/roslaunch-2_xterm-7885.log
    Checking log directory for disk usage. This may take a while.
    Press Ctrl-C to interrupt
    Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://2_xterm:41355/



  • /rosdistro: noetic
  • /rosversion: 1.15.9

topic_publisher (topic_publisher/simple_topic_publisher)


ERROR: cannot launch node of type [topic_publisher/simple_topic_publisher]: topic_publisher
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/user/catkin_ws/src
ROS path [2]=/home/simulations/public_sim_ws/src
ROS path [3]=/opt/ros/noetic/share
No processes to monitor
shutting down processing monitor…
… shutting down processing monitor complete

Thank you in advance, greetings.


This is the error. It means your C++ source has not been properly built. Were you able to run catkin_make successfully? Try again:

cd ~/catkin_ws
rm -rf build/ devel/
source devel/setup.bash

Ensure the commands above run without any errors.

Then, run the roslaunch command again.

Yes, I had been able to run catkin_make before.

[100%] Built target simple
[100%] Built target simple_topic_publisher

Either way, I followed your command lines and I got the same output as before.
ERROR: cannot launch node of type [topic_publisher/simple_topic_publisher]: topic_publisher

I have also tried completely removing the package and creating it back again the way I showed above but same thing.

After examining your package, I found that the name of your package is topic_publisher_pkg, not topic_publisher as you specified in the launch file.

So your launch file should have the pkg tag pkg=“topic_publisher_pkg”.

It did work!

Thanks a lot @bayodesegun.



This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.