Did you make/build the package after adding the service message?
I believe this makes the service message “available” for access with service list command. (Although, I may be wrong.)
What creates the service is the service server. Which should be a script in your services_quiz directory. If you have not made that, or if you have and you are not running it, the service should not appear.
What should appear though is the Turn.srv interface when doing ros2 interface list.
As Girish says, also remember to build the package with colcon build from the ros2_ws directory in the shell.
Thank you for your answer but I’m concerned this is not it.
I don’t remember when I’ve first created the pkg services_quiz and the service Turn.srv in services_quiz_srv but I built it before and after the command ros2 service list
For other services built was not necessary (see the beginning of section 4) colcon build is not here but services are presented
When you ask for a list of services available (ros2 service list) you are getting a list of services that are running at present. This means, nodes that are running right now in the computer and that have a service server. If you have a node that has a service server, and that node is not running, then the service of that node will not appear. Only the nodes running are taken into account when asking for services available. Actually, we should not say services available but running services.
Another thing is the message (also called interface) of a service. The message/interface of a service is the structure of data that the service will use to exchange information between the server and the client. So, if you do a ros2 interface list you will get a list of ALL THE MESSAGES/INTERFACES THAT EXIST IN THAT COMPUTER. However, in order for a service message/interface to appear in the list, you must have sourced the ROS2 workspace that contains the definition of that message/interface.
Having understood the previous two points, now we can solve your problem:
you need to source the ROS2 workspace that contains the definition of Turn.srv. That workspace is ros2_ws.
So you need to do:
source ~/ros2_ws/install/setup.bash
That source, includes already a source of /opt/ros/foxy/setup.bash in the inside, so you don’t need to source again the Foxy directory.
Now, you can list the messages/interfaces available with:
ros2 interface list
You should see your message in the list of services.