rosbridge_suite icon indicating copy to clipboard operation
rosbridge_suite copied to clipboard

Subscriber to topic throughput decrease eventually

Open oriolorra opened this issue 1 year ago • 4 comments

Hi,

I have encountered some odd behavior. At some point, a subscriber topic decrease throughput, when the publishing topic does not decrease the throughput.

  1. I have a cpp node publishing a string representing a base64 image at 10Hz, which its rate does not decrease over time. Checked via ros2 topic hz /b64_image.
  2. Rosbridge_server is launched too, via ros2 launch rosbridge_server rosbridge_websocket_launch.xml.
  3. A webpage is receiving /b64_image with roslibjs, and the image is rendered into a canvas. Eventually, the frame rate (fps) of message received decrease almost to 0 fps (image attached). If, I refresh manually, the webpage returns to 10fps but return to 0 fps a few seconds later.

Roslibjs topic is configured like this:

 var listener = new ROSLIB.Topic({
    ros : ros,
    name : '/b64_image',
    messageType : 'std_msgs/String',
    queue_size: 1,
    throttle_rate: 10
    })

image

  • Library Version: 1.3.2-1jammy.20240517.175148
  • ROS Version: ROS2 Humble
  • Platform / OS: Ubuntu 22.04

Expected Behavior I expect to get an almost constant frame rate at 10 fps at the webpage, let's say forever.

Actual Behavior Webpage has 10 fps during only a few seconds/minuts.

Thanks

oriolorra avatar May 31 '24 05:05 oriolorra

We use our robots in environments where the network conditions are sometimes quite bad and I have seen the exact same issue which seems to be exacerbated by the network dropping in and out. I was able to fix it by removing the timeout at https://github.com/RobotWebTools/rosbridge_suite/blob/c1bfc2ff451069b2a40544581e2910d20efc3f62/rosbridge_server/scripts/rosbridge_websocket.py#L342 I would be interested to see if that fixes it for you too

joshjowen avatar Nov 15 '24 07:11 joshjowen

same issue. I have a camera oakd-lite on my robot. it communicates via wifi and I get around 1Hz at some point on my client side, while 10Hz is still good on my robot side. I use compressed IMage. The previous solution is not working for me, it blocks completely my code

flxinxout avatar Jun 04 '25 21:06 flxinxout

Yeah that only worked in testing for some scenarios for us too. We ended up going to RWS which is mostly a drop in replacement for rosbridge and I couldn't recommend it more

joshjowen avatar Jun 04 '25 22:06 joshjowen

@joshjowen thanks for the reply. but do you have any idea why this happens? Additionally, I see that not all functionalities are available in RWS, which will not work for us.

flxinxout avatar Jun 07 '25 10:06 flxinxout