Unit 4: Exercise 4.1: Topic Publishers. I can't found '/count' topic

Dear everybody,

I have done all the steps in exercise 4.1 correctly, including:

  • Create a new package named topic_publisher_pkg.
  • Inside the src folder of the package, create a new file named simple_topic_publisher.cpp.
  • Create a launch file for launching this code.
  • Do the necessary modifications to your CMakeLists.txt file, and compile the package.
  • Execute the launch file to run your executable.

After execute:
source ~/ros2_ws/install/setup.bash

And after the execution of:
ros2 pkg list | grep 'topic_publisher_pkg'

The package appear correctly:

user:~/ros2_ws$ ros2 pkg list | grep 'topic_publisher_pkg'

The problem comes when I want to continue with the exercise by running:
ros2 topic list | grep '/counter'

Unfortunately the topic “/counter” does not appear. The truth is that I don’t understand how to continue because the “topic” that it should list doesn’t appear.

Will I have any errors in the code? Do I need to take any steps to make this happen?

Thanks so much for the help that you can provide to me.

Best regards,


Since the topic is created by your package code, you have to run your package before the topic is created and made available.

If the topic is not available after launching your package, then please check that:

  • The package node (executable) is actually running (check the list of nodes)
  • The code is properly creating the topic (via a published). Check the code is properly written

Thanks @bayodesegun !!

I’ll try it!!!



1 Like