Unit 2 ros topics

I think there is something missing in chapter two. first nothing is said about the content of the launch file .
the following code is what i put in it




second if i try to run the simple_topic_publisher.cpp file from the web browser, the appears underneath the lines of code

File “”, line 4
int main(int argc, char** argv) {
^
SyntaxError: invalid syntax

and my rostopic list | grep and rostopic info /counter result in nothing.
please help

Hello @ogunsola.olubukola,

Let’s go by parts:

  1. The contents of the launch file are supposed to be created by you. You can get the knowledge required in order to create it by your own in the previous Unit (Unit 1. Basic Concepts). However, if you still have problems in order to create it by your own, you can find the solutions for the Exercises of the Unit at the end of the notebook (you will find a link that points to Topics Part 1 Solutions)

  2. When you say that you try to “run the simple_topic_publisher.cpp file from the web browser”, what do you mean exactly? How are you trying to execute this code?
    In order to be able to execute this code you need to:
    a. Create and place this simple_topic_publisher.cpp file inside a ROS package
    b. Prepare the CMakeLists.txt file of the package for compilation
    c. Compile your package in order to generate the executable
    d. Create the launch file that will start your executable
    You can find all these steps described in the Exercise itself, but also in the previous Unit (Unit 1 Basic Concepts) with more detail.

Hope this helps you,