Example 3.6 own service message

I followed the instructions and the example worked upto the place where we check our new service msg: rossrv list | grep MyCustomServiceMessage
image

In second part Using a Custom Service Message:
I created the custom_service_server.cpp and copied the code as well as modified the CMakeLists.txt
I am really not sure that we have to create a launch file, but I create one for this package.
<launch> <node pkg="my_custom_srv_msg_pkg" type="custom_service_server" name="service_server" output="screen"/> </launch>

I complied the package using : user:~/catkin_ws$ catkin_make --only-pkg-with-deps my_custom_srv_msg_pkg
and encountered the following error

any suggestions what I am doing wrong here?
Thank you very much in advance!!

Hi @shaktigehlaut,

Does your service message define radius and repetitions, which the C++ code is trying to access? The error message says it cannot find these as “members” of your custom message.

If you copy-pasted the sample message and the sample C++ code verbatim, this error will happen, as the sample (meant to be a sample, not the real thing :wink:) message does not contain these members:

int32 duration    # The number of times BB-8 has to execute the square movement when the service is called
---
bool success         # Did it achieve it?

Could you please check that and let us know?

Hi @bayodesegun thanks for the quick reply.
Yes you are right my message contains the same message, which was created in the first part.

So I should change the message content, so it will be compiled correctly?

1 Like

Yes :+1: , either add those members to the message definition or remove them from the C++ code, whichever you find easier.

However, the real exercise comes next!

@bayodesegun Thank you very much!!

1 Like