I tried searching for this issue in the forum but couldn’t find anything similar. I tried to execute example 3.1, after compiling and sourcing the workspace I used the command rosrun:
rosrun my_examples_pkg simple_topic_publisher.py
Nothing happens, as you can see from the screenshot:
I waited a while but it just keeps blinking. I tried to copy the next command in the example but nothing happens.
Hello @Gideon_Spek, welcome to the community!
The expected result from running that code is that nothing happens, at least at first glance.
Please keep on reading the instructions that follow exercise 3.1. It is explained if you continue advancing through the course.
For instance, what is the output if you keep that code running and in a new Command Line Shell you input this command?:
rostopic list | grep '/counter'
Hope this helps,
Hi @rzegers ,
After entering the command into the Shell, still nothing happens, like in this screenshot:
I have waited a while but there is no output in the Shell.
Hi @Gideon_Spek ,
@rzegers is correct about the information/advice.
Let me explain it to you better.
The code that you have prints the output in a ROS topic called “/counter”. Thus you are unable to see the messages on your screen.
You can see the messages on your screen only if you have any print statement on your code. Currently, your code does not have any print statements. Thus you are unable to see any output on your screen.
I have finished this exercise. So trust me, it is correct.
So, If you want to see the output, do the following:
- Execute rosrun my_examples_pkg simple_topic_publisher.py on web terminal 1.
- Once started, switch to terminal 2 and execute rostopic echo /counter
Now, you will be able to see the output that this program prints onto ROS topic /counter.
Please let us know if you got it right!
Regards and cheers,
Just realized something really wrong in your second image.
Once you execute a command line after
user:~/catkin_ws$, you should not execute another new commandline right under it.
That is why the command
rostopic list | grep /counter did not work.
Which brings me to this very important advise:
If you have not understood the basic functionality of a terminal / command prompt in Linux machine, you must definitely take the Linux for Robotics (FREE course) on this website. This is very important before you can proceed further with your current course or any other course on this website.
Thank you very much @girishkumar.kannan , I now understand my mistake.
Many thanks @girishkumar.kannan for actively helping him with the exercise!
This topic was automatically closed after 23 hours. New replies are no longer allowed.