ROS2 service only sometimes present in python
Hello,
On Ubuntu 20.4 with ros2 foxy installed, I am currently running a python script (as root), where I want to get some information from a ros2 service (/get_entity_state from gazebo, also running as root).
Normally, everything works fine, but sometimes, when I start up my script (like the client in this tutorial) , only some services are present (via node.get_service_names_and_types():
'/position_handler/describe_parameters',
'/position_handler/get_parameter_types',
'/position_handler/get_parameters',
'/position_handler/list_parameters',
'/position_handler/set_parameters',
'/position_handler/set_parameters_atomically',
'/robot_state_publisher/describe_parameters',
'/robot_state_publisher/get_parameter_types',
'/robot_state_publisher/get_parameters',
'/robot_state_publisher/list_parameters',
'/robot_state_publisher/set_parameters',
'/robot_state_publisher/set_parameters_atomically',
'/rqt_gui_py_node_28169/describe_parameters',
'/rqt_gui_py_node_28169/get_parameter_types',
'/rqt_gui_py_node_28169/get_parameters',
'/rqt_gui_py_node_28169/list_parameters',
'/rqt_gui_py_node_28169/set_parameters',
'/rqt_gui_py_node_28169/set_parameters_atomically'
The daemon is running, and in console, all services are present, so I would have expected for this to not be possible.
After some more tries, normally the services appear again, but it is not clear to me, why.
Also sometimes ros2 service list
(and also the topics) will be completely empty, while a call to a service is successfully done in the same console, or the console will show no services, but python does, or vice versa.
I am not a ROS expert, so maybe I am missing something here, but shouldn't the service be always available (or at least visible), if the daemon is running?
Thank you for any help
EDIT:
could it be, that node.get_...
only returns the nodes own findings? When I loop over the connection, normally the second try connects without any problems. Is it possible to access the daemon directly from the node?