Delay problem of subscribing image topic from ROS in Unity

Hi, I tried to publish a sensor_msgs/Image from ROS to visualize in Unity. I installed ROS-TCP-Connector and Unity Robotics Visualization packages. My image size is 480*640. When my publishing frequency is 30 Hz in ROS, the image visualized in the HUB is like slow motion, and the delay increase as time goes by. I check the time interval of each message callback function, which is around 0.06s (Not fixed frequency). So I reduce the publishing frequency to 5 Hz in ROS, then the delay problem in Unity disappears.

So I am wondering how to change the subscription frequency in Unity to enhance the performance.

  • Unity version: 2021.3.4 f1
  • ROS TCP Connector: 0.7.0
  • Unity Robotics Visualizations: 0.7.0

Hi, sorry for the delay in replying. I suggest you try our experimental high performance version of Ros-Tcp-Endpoint: GitHub - Unity-Technologies/ROS-TCP-Endpoint at Roscpp

i am having the same lag problem when subscribing to an image topic send over to unity by ROS can u suggest a solution.

I have the same issue. I have to put my image resolution to 200x200 pixels if I want to avoid increasing latency at 20Hz.

From the Unity Robotics Hub repo:

So what would be the expected subscribe time for a 1036x1698 image? 0.6 minus 0.012 seconds? (So basically 0.6 seconds) I do get about 0.6 seconds for this resolution with the TCP Connector and Endpoint, so does this mean this is an expected limitation?

In any case, shouldn’t frames be dropped if Unity can’t keep up? Why do we keep receiving the messages later on with ever increasing latency?