How to check the service server in the services Quiz lesson?

Hallo everyone,

i am trying to do the quiz at the Unit 3 “Services in ROS” and have here a problem.

I have created a launch file for the service serve python file. And i could also launch it and nothing wrong happend. Now I want to call the service server with the command: rosservice call /<name_service> TAB TAB, and it always showed me an error.

My question is: Do i have to fill the value for two variables (side and repetitions) in this command or it will move automatically the Robot after TAB TAB ?

  • Note: I have edited two files in the srv directory and also compile the package and source the newly generated messages

@delethai.mai,

This error message indicates that your custom service message is not properly setup yet. Please review all the steps specified in the notebook using the post below as a guide.

ERROR: Cannot load message class for [package/Message]. Are your messages built?


When you fully complete the message setup, the relevant variables will show up after TAB TAB and you will need to specify values for them.

I have tried your suggestions, but it still didn’t work. Can you please check my code? Maybe some things went wrong here. If not, please give me another suggestions, thanks!

Make sure have:

  1. the .srv file in the package
  2. adjusted the CMakeLists.txt and package.xml (look at the 'my_custom_srv_msg_pkg for reference)
  3. catkin_make
  4. source ~/catkin_ws/devel/setup.bash (has to be done for every shell)
3 Likes

I have checked your code and found that you have everything correct.

The reason why you could not autocomplete the rosservice call command is twofold (as @simon.steinmann91 is indicating in his answer above) :

  1. You have to compile your code using catkin_make command. Because you have created a new message, you need to compile. Remember that the catkin_make command has to be launched in the ~/catkin_ws directory. You cannot launch the compilation command on any directory, only on that specific one
  2. On EVERY SHELL you have to source the new configuration. This means, you have to launch the command source ~/catkin_ws/devel/setup.bash on every shell that you want to launch a command or program that needs to use the new messages.

Once you do those two things, you will be able to do TAB TAB and the message will appear automatically.

Let me know if that works for you

2 Likes

Thanks for your help, you guys,
I really forgot to source the configuration on every shell

1 Like