Exercise 3.1 /trajectory_by_name

I am having problem for Exercise 3.1 for interacting with a service pragmatically!

I created a package named service_client_pkg with dependency roscpp.
in src folder simple_service_client.cpp was created and the code was copied from the instructions.
I created a launch file, the Cmake list was modified as follows:

In instructions (point number 3) :
Create a launch file for launching this code. Keep in mind that, in order to be able to call the /trajectory_by_name service, you need to have it running.

I started the service as follows:
user:~/catkin_ws$ roslaunch trajectory_by_name start_service.launch

I see still red errors with the simple_service_client.cpp file

I tried compiling the package and encountered the following error:

Could you please suggest the correct way/steps for compilation of project?
Or which step i haven’t executed correctly?
Thank you very much in advance!!

Hi @shaktigehlaut,

First of all, welcome to the community!

You can ignore the red lines in the cpp file.

As for the compilation error, it’s because of a typo in the CMakeLists.txt file, on line 146, as pointed out by the error message. Perhaps you mistakenly deleted some characters, included an invalid character, or missed out a brace on the line. Please check.

Thank you very much I cross checked my CMakeLists.txt file.

But now I have another error:

Also my service is running!!

Any suggestions?

Hi @shaktigehlaut,

You need to include the package trajectory_by_name_srv as dependency in your package. I apologize that this was not mentioned in the notebook. We will update the notebook ASAP.

The easiest way is to add it as a dependency when creating the package:

catkin_create_pkg service_client_pkg roscpp trajectory_by_name_srv

But since you have created the package already, just modify your CMakeLists.txt and package.xml as follows:

  • CMakeLists.txt: add trajectory_by_name_srv to find_package
find_package(catkin REQUIRED COMPONENTS
  • package.xml: add trajectory_by_name_srv as a dependency, just like roscpp.

Please let us know how it goes.

Thank you very much for the help. It did worked.

Also I would like say that please hint out that in launch file following should be included:

<include file="$(find trajectory_by_name)/launch/start_service.launch"/>