Best way of using same Ros node with multiple clients

asked 2020-09-17 13:21:11 -0500

prem@Robotics gravatar image


I have a Ros node running in a server with gpu which takes input as image on /rgb/image topic, process image and gives output as String on /obstacle topic. Now if I send an image as an input to server using flask, the image in the server is getting converted to ROS image and processing happens where i get obstacle direction as a response to the client code.

The main code which is running in the server is completely developed on topics, publishing and subscribing communication. When I send the inputs with multiple clients... the images are passing through input topic , as they are getting feed through common input topic the responses are getting mixed..

What is the best way to get it work with multiple clients without running the same node multiple times using namespace or different node name tag in launch file? because it will be very heavy if there are more than 10-20 clients Can I address this problem with Ros_bridge_suite ? ed

edit retag flag offensive close merge delete


@prem@Robotics, the main problem I think is that you have data races when you send another image. Either you generate another instance if the processing nodes of you use some flow control of critical sections like mutex or semaphores. Another solution depending on your needs is to block the processing of new images in the client until the last image is processed. Maybe actionlib approach is the most suitable for this.

Weasfas gravatar image Weasfas  ( 2020-09-19 06:23:53 -0500 )edit