You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a namespace is configured in the zenoh_config.json5 file under the ros2dds plugin, the service communication between my TurtleBot2i (acting as a client) and my Ubuntu computer (acting as a server) fails. Removing the namespace resolves the issue. But I need to use namespace in my application.
importrclpyfromrclpy.nodeimportNodefromstd_srvs.srvimportTriggerfromlifecycle_msgs.srvimportGetStateclassMapService(Node):
def__init__(self):
super().__init__('map_service')
self.srv=self.create_service(Trigger, 'check_mapping', self.check_mapping_callback)
self.lifecycle_client=self.create_client(GetState, '/rtabmap/get_state')
whilenotself.lifecycle_client.wait_for_service(timeout_sec=1.0):
self.get_logger().info('Waiting for lifecycle service to be available...')
defcheck_mapping_callback(self, request, response):
self.get_logger().info('Received request to check mapping status')
future=self.lifecycle_client.call_async(GetState.Request())
rclpy.spin_until_future_complete(self, future)
lifecycle_state=future.result().current_state.labeliflifecycle_state=='active':
response.success=Trueresponse.message='Mapping node is active'else:
response.success=Falseresponse.message=f'Mapping node is in {lifecycle_state} state'self.get_logger().info(f'Sending response: {response.message}')
returnresponsedefmain(args=None):
rclpy.init(args=args)
node=MapService()
rclpy.spin(node)
rclpy.shutdown()
if__name__=='__main__':
main()
Client Implementation on TurtleBot2i:
importrclpyfromrclpy.nodeimportNodefromstd_srvs.srvimportTriggerimportosclassMapClient(Node):
def__init__(self):
super().__init__('map_client')
self.client=self.create_client(Trigger, 'check_mapping')
whilenotself.client.wait_for_service(timeout_sec=1.0):
self.get_logger().info('Waiting for map_service to be available on Ubuntu...')
self.timer=self.create_timer(5.0, self.check_mapping_status)
defcheck_mapping_status(self):
request=Trigger.Request()
future=self.client.call_async(request)
future.add_done_callback(self.handle_response)
defhandle_response(self, future):
try:
response=future.result()
ifnotresponse.success:
self.get_logger().info('Mapping is not active on Ubuntu, starting it locally on NUC.')
self.start_local_mapping()
exceptExceptionase:
self.get_logger().error(f'Service call failed: {str(e)}')
defstart_local_mapping(self):
# Iniciar o mapeamento localmente no NUCos.system('ros2 launch my_package start_mapping_launch.py')
defmain(args=None):
rclpy.init(args=args)
node=MapClient()
rclpy.spin(node)
rclpy.shutdown()
if__name__=='__main__':
main()
Start the service on the Ubuntu computer.
Attempt to call the service from the TurtleBot2i.
Observe the error: WARN zenoh_plugin_ros2dds::route_service_cli] Route Service Client (ROS:/check_mapping <-> Zenoh:turtlebot/check_mapping): received NO reply for request (6b771a6ecb3be14d,1) - cannot reply to client, it will hang until timeout.
The same happens with the add_two_ints_client and add_two_ints_server services from the demo_nodes_py package when the client is run before the server.
System info
Platform: Ubuntu 22.04 64-bit
CPU: Intel NUC BOXNUC6CAYH
Zenoh version/commit: zenoh-bridge-ros2dds v0.10.1-rc.2 built with rustc 1.72.0 (5680fa18f 2023-08-23)
The text was updated successfully, but these errors were encountered:
Hi @sabrinaacardoso ,
Apologies for this late reply.
Did you try again with recent version (1.0.x) ?
I tried to run a modified version of your example, because I miss your /rtabmap/get_state Node:
removing the lines calling self.client I don't see your error (the bridge running with or without namespace config).
Are you sure your server was not hanging in the callback and thus not sending a response ?
Describe the bug
When a namespace is configured in the
zenoh_config.json5
file under theros2dds
plugin, the service communication between my TurtleBot2i (acting as a client) and my Ubuntu computer (acting as a server) fails. Removing the namespace resolves the issue. But I need to use namespace in my application.To reproduce
Zenoh Configuration on TurtleBot2i:
Zenoh Configuration on Ubuntu:
Service Implementation on Ubuntu:
Client Implementation on TurtleBot2i:
Start the service on the Ubuntu computer.
Attempt to call the service from the TurtleBot2i.
Observe the error:
WARN zenoh_plugin_ros2dds::route_service_cli] Route Service Client (ROS:/check_mapping <-> Zenoh:turtlebot/check_mapping): received NO reply for request (6b771a6ecb3be14d,1) - cannot reply to client, it will hang until timeout
.The same happens with the
add_two_ints_client
andadd_two_ints_server
services from thedemo_nodes_py
package when the client is run before the server.System info
The text was updated successfully, but these errors were encountered: